edu.iu.cnets.klatsch.lang
Class VProperty

java.lang.Object
  extended by edu.iu.cnets.klatsch.lang.Value
      extended by edu.iu.cnets.klatsch.lang.VProperty
All Implemented Interfaces:
Callable

public class VProperty
extends Value
implements Callable

This class encapsulates "properties", which are wrappers around methods contained in the subclasses of Pane. In order to invoke one of these methods in Klatsch, you get one of these values using the prop() method in VPane, then invoke it like any other procedure. The Pane itself is stored in the VProperty object, so you don't need to include it at invocation time. Exposure of a method as a property in a subclass of Pane is as simple as making sure it has the name "prop_[NAME]".


Field Summary
(package private)  java.lang.String name
          the name of the primitive
(package private)  Pane pane
          the pane containing this property
(package private)  java.lang.reflect.Method prop
          the method to invoke
 
Constructor Summary
VProperty(Pane pane, java.lang.String name, java.lang.reflect.Method prop)
          Create a new wrapper for a property for the given pane, name, and method.
 
Method Summary
 Value apply(Value... args)
          Invoke the property for which we were instantiated.
 java.lang.String toString()
          Returns a string representation of the property.
 
Methods inherited from class edu.iu.cnets.klatsch.lang.Value
require, requireCount, requireType, toJson
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pane

Pane pane
the pane containing this property


name

java.lang.String name
the name of the primitive


prop

java.lang.reflect.Method prop
the method to invoke

Constructor Detail

VProperty

public VProperty(Pane pane,
                 java.lang.String name,
                 java.lang.reflect.Method prop)
Create a new wrapper for a property for the given pane, name, and method.

Parameters:
pane - the pane containing the property
name - the property name
prop - the property implementation
Method Detail

apply

public Value apply(Value... args)
            throws EvaluationException
Invoke the property for which we were instantiated.

Specified by:
apply in interface Callable
Parameters:
args - the arguments to pass in
Returns:
the return value
Throws:
EvaluationException - for any runtime errors

toString

public java.lang.String toString()
Returns a string representation of the property.

Specified by:
toString in class Value
Returns:
the string