pnuts.ext
Class PropertyAccessor

java.lang.Object
  |
  +--pnuts.ext.PropertyAccessor
All Implemented Interfaces:
AbstractData, Property

public class PropertyAccessor
extends java.lang.Object
implements AbstractData

When a pnuts.lang.Property object has functions as its values, the functions can be called as follows.

 object.name = function () null
 (object.name)()
 

This class makes this expression a little simpler.

 exported = PropertyAccessor(object)
 exported.name()
 

A concrete class of pnuts.lang.AbstractData can be used for the same purpose, but the name of properties and its public methods may conflict.


Constructor Summary
PropertyAccessor(Property property)
           
 
Method Summary
 java.lang.Object get(java.lang.String name, Context context)
          This method defines the behavior of the following expression.
 Property getProperty()
           
static Property getProperty(PropertyAccessor accessor)
           
 java.lang.Object invoke(java.lang.String name, java.lang.Object[] args, Context context)
           
 void set(java.lang.String name, java.lang.Object object, Context context)
          This method defines the behavior of the following expression.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyAccessor

public PropertyAccessor(Property property)
Method Detail

get

public java.lang.Object get(java.lang.String name,
                            Context context)
Description copied from interface: Property
This method defines the behavior of the following expression.
    aProperty . name
 
Specified by:
get in interface Property
Following copied from interface: pnuts.lang.Property
Parameters:
name - the name.
conext - the context in which the expression is evaluated.

set

public void set(java.lang.String name,
                java.lang.Object object,
                Context context)
Description copied from interface: Property
This method defines the behavior of the following expression.
    aProperty . name = value
 
Specified by:
set in interface Property
Following copied from interface: pnuts.lang.Property
Parameters:
name - the name.
value - the value.
context - the context in which the expression is evaluated.

invoke

public java.lang.Object invoke(java.lang.String name,
                               java.lang.Object[] args,
                               Context context)
Specified by:
invoke in interface AbstractData

getProperty

public Property getProperty()

getProperty

public static Property getProperty(PropertyAccessor accessor)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object