org.iscreen.impl
Class OgnlObjectMapping

java.lang.Object
  extended by org.iscreen.impl.OgnlObjectMapping

public class OgnlObjectMapping
extends java.lang.Object

This class provides mapping data from one object to another via two sets of OGNL expressions: one to get the value from one object; and one to set that value on another object.

Author:
Shellman, Dan

Field Summary
protected  java.lang.Object getterAST
           
protected  java.lang.String getterExp
           
protected  java.lang.Object setterAST
           
protected  java.lang.String setterExp
           
 
Constructor Summary
OgnlObjectMapping(java.lang.String getter, java.lang.String setter)
          Default constructor taking the 'getter' OGNL expression and the 'setter' OGNL expression.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Equality is based upon the 'setter' OGNL expression (not the 'getter' expression).
 java.lang.String getGetter()
          Retrieves the 'getter' OGNL expression that this mapper is configured to use.
 java.lang.String getSetter()
          Retrieves the 'setter' OGNL expression that this mapper is configured to use.
 int hashCode()
          The hash code is based upon the 'setter' OGNL expression.
 void map(java.lang.Object fromBean, java.lang.Object toBean)
          Maps a property from the fromBean to the toBean using the configured OGNL getter/setter expressions.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

getterExp

protected java.lang.String getterExp

setterExp

protected java.lang.String setterExp

getterAST

protected java.lang.Object getterAST

setterAST

protected java.lang.Object setterAST
Constructor Detail

OgnlObjectMapping

public OgnlObjectMapping(java.lang.String getter,
                         java.lang.String setter)
Default constructor taking the 'getter' OGNL expression and the 'setter' OGNL expression. This is a fail-fast call, so if the getter or setter OGNL expressions are "invalid," then an unchecked exception (ConfigurationException) will be thrown.

Parameters:
getter - The 'getter' OGNL expression.
setter - The 'setter' OGNL expression.
Method Detail

map

public void map(java.lang.Object fromBean,
                java.lang.Object toBean)
Maps a property from the fromBean to the toBean using the configured OGNL getter/setter expressions. If the objects can't accept the OGNL expressions, an unchecked ConfigurationException is thrown.

Parameters:
fromBean - The object to copy the property from (the source).
toBean - The object to copy the property to (the destination).

getGetter

public java.lang.String getGetter()
Retrieves the 'getter' OGNL expression that this mapper is configured to use.

Returns:
Returns the 'getter' OGNL expression.

getSetter

public java.lang.String getSetter()
Retrieves the 'setter' OGNL expression that this mapper is configured to use.

Returns:
Returns the 'setter' OGNL expression.

hashCode

public int hashCode()
The hash code is based upon the 'setter' OGNL expression.

Overrides:
hashCode in class java.lang.Object
Returns:
Returns the hash code for this mapper.

equals

public boolean equals(java.lang.Object obj)
Equality is based upon the 'setter' OGNL expression (not the 'getter' expression).

Overrides:
equals in class java.lang.Object
Parameters:
obj - The mapper to compare to
Returns:
Returns true only if the 'setter' OGNL expressions are identical (meaning the Strings are equal).