org.webmacro.engine
Class PropertyOperatorCache

java.lang.Object
  extended byorg.webmacro.engine.PropertyOperatorCache

public final class PropertyOperatorCache
extends java.lang.Object


Constructor Summary
PropertyOperatorCache()
           
 
Method Summary
 java.util.Iterator getIterator(java.lang.Object instance)
          Evaluate the supplied object and work out a way to return it as an iterator.
 org.webmacro.engine.PropertyOperator getOperator(java.lang.Class type)
           
 org.webmacro.engine.PropertyOperator getOperator(java.lang.Object obj)
           
 java.lang.Object getProperty(Context context, java.lang.Object instance, java.lang.Object[] names)
          Calls getProperty(context, instance, names, 0)
 java.lang.Object getProperty(Context context, java.lang.Object instance, java.lang.Object[] names, int start)
          Attempt to retrieve a property using the rules of property introspection described above.
 void init(Broker b, Settings config)
           
 boolean setProperty(Context context, java.lang.Object instance, java.lang.Object[] names, int start, java.lang.Object value)
          Given a property description name, attempt to set the property value to the supplied object.
 boolean setProperty(Context context, java.lang.Object instance, java.lang.Object[] names, java.lang.Object value)
          Calls setProperty(context, names, 0, value)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyOperatorCache

public PropertyOperatorCache()
Method Detail

init

public final void init(Broker b,
                       Settings config)
                throws InitException
Throws:
InitException

getOperator

public final org.webmacro.engine.PropertyOperator getOperator(java.lang.Class type)
                                                       throws PropertyException
Throws:
PropertyException

getOperator

public final org.webmacro.engine.PropertyOperator getOperator(java.lang.Object obj)
                                                       throws PropertyException
Throws:
PropertyException

getProperty

public final java.lang.Object getProperty(Context context,
                                          java.lang.Object instance,
                                          java.lang.Object[] names,
                                          int start)
                                   throws PropertyException,
                                          java.lang.SecurityException
Attempt to retrieve a property using the rules of property introspection described above. Begin reading names at position start in the array of names.

Parameters:
context - is used to resolve sub-properties in arguments
instance - is the root of introspection
names - property names, one per array entry
Returns:
the property described by the names, inside the instance
Throws:
PropertyException - the property we'd like to look at
java.lang.SecurityException - you are not permitted to try

getProperty

public final java.lang.Object getProperty(Context context,
                                          java.lang.Object instance,
                                          java.lang.Object[] names)
                                   throws PropertyException,
                                          java.lang.SecurityException
Calls getProperty(context, instance, names, 0)

Throws:
PropertyException
java.lang.SecurityException

setProperty

public final boolean setProperty(Context context,
                                 java.lang.Object instance,
                                 java.lang.Object[] names,
                                 int start,
                                 java.lang.Object value)
                          throws PropertyException,
                                 java.lang.SecurityException
Given a property description name, attempt to set the property value to the supplied object.

Parameters:
context - An object containing a property
names - The string names of that property
value - the new value the property is to be set to
Throws:
PropertyException - not possible to set the property
java.lang.SecurityException - you are not permitted to try

setProperty

public final boolean setProperty(Context context,
                                 java.lang.Object instance,
                                 java.lang.Object[] names,
                                 java.lang.Object value)
                          throws PropertyException,
                                 java.lang.SecurityException
Calls setProperty(context, names, 0, value)

Throws:
PropertyException
java.lang.SecurityException

getIterator

public final java.util.Iterator getIterator(java.lang.Object instance)
                                     throws PropertyException
Evaluate the supplied object and work out a way to return it as an iterator.

Parameters:
instance - an object believed to represent a list
Returns:
an Iterator that iterates through that list
Throws:
PropertyException - could not extract iterator from instance