com.zipxap.vfs.dal.utility
Class JavabeanWrapper<t>

java.lang.Object
  extended by com.zipxap.vfs.dal.utility.JavabeanWrapper<t>

public class JavabeanWrapper<t>
extends java.lang.Object

This is a convenience class for working with JavaBeans. It allows developers to get and set properties of the bean dynamically.


Constructor Summary
JavabeanWrapper(java.lang.Class beanType)
          Instantiate a Javabean of the specified beanType and put a wrapper around it.
JavabeanWrapper(t bean)
          Create a wrapper for the specified bean
 
Method Summary
 t getJavaBean()
          Retrieve the JavaBean wrapped by this JavabeanWrapper.
 java.lang.String[] getPropertyNameAbbreviations()
           
 java.lang.String[] getPropertyNames()
          Retrieve the names of the properties of the wrapped JavaBean.
 java.lang.Class getPropertyType(java.lang.String fullPropertyName)
          Retrieve the type of the property of the specified propertyName.
 java.lang.Class getPropertyType(java.lang.String fullPropertyName, boolean ignoreUnknownProperties)
          Retrieve the type of the property of the specified propertyName.
 java.lang.Object getValue(java.lang.String fullPropertyName)
          Retrieve the value of the property of the specified propertyName.
 boolean isProperty(java.lang.String fullPropertyName)
          Determine if the specified propertyName is a valid property of the Javabean wrapped by this JavabeanWrapper.
 void setValue(java.lang.String fullPropertyName, java.lang.Object value)
          Set the value of the property of the specified propertyName.
 void setValue(java.lang.String fullPropertyName, java.lang.Object value, boolean ignoreUnknownProperties)
          Set the value of the property of the specified propertyName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavabeanWrapper

public JavabeanWrapper(t bean)
Create a wrapper for the specified bean

Parameters:
bean - the JavaBean to wrap.

JavabeanWrapper

public JavabeanWrapper(java.lang.Class beanType)
Instantiate a Javabean of the specified beanType and put a wrapper around it.

Parameters:
beanType - the type of the Javabean to instantiate.
Method Detail

getPropertyNames

public java.lang.String[] getPropertyNames()
Retrieve the names of the properties of the wrapped JavaBean.

Returns:
The names of the properties of the wrapped JavaBean.

getPropertyNameAbbreviations

public java.lang.String[] getPropertyNameAbbreviations()

isProperty

public boolean isProperty(java.lang.String fullPropertyName)
Determine if the specified propertyName is a valid property of the Javabean wrapped by this JavabeanWrapper.

Parameters:
fullPropertyName - the name of the property to validate
Returns:
true if the Javabean wrapped by this JavabeanWrapper contains this property, else false.

getPropertyType

public java.lang.Class getPropertyType(java.lang.String fullPropertyName)
Retrieve the type of the property of the specified propertyName.

Parameters:
fullPropertyName - The name of the property to discover the type of.
Returns:
the type of the property of the specified propertyName.

getPropertyType

public java.lang.Class getPropertyType(java.lang.String fullPropertyName,
                                       boolean ignoreUnknownProperties)
Retrieve the type of the property of the specified propertyName.

Parameters:
fullPropertyName - The name of the property to discover the type of.
ignoreUnknownProperties - If set to true then this method will return a null for unknown properties, otherwise an exception is thrown.
Returns:
the type of the property of the specified propertyName.
Throws:
UCIllegalArgumentException - if ignoreUnknownProperties is false and there is no property named propertyName.

getValue

public java.lang.Object getValue(java.lang.String fullPropertyName)
Retrieve the value of the property of the specified propertyName.

Parameters:
fullPropertyName - The name of the property to discover the value of.
Returns:
the value of the property of the specified propertyName.

setValue

public void setValue(java.lang.String fullPropertyName,
                     java.lang.Object value)
Set the value of the property of the specified propertyName.

Parameters:
fullPropertyName - The name of the property to set the value of.
value - The value to assign to the property.

setValue

public void setValue(java.lang.String fullPropertyName,
                     java.lang.Object value,
                     boolean ignoreUnknownProperties)
Set the value of the property of the specified propertyName.

Parameters:
fullPropertyName - The name of the property to set the value of.
value - The value to assign to the property.
ignoreUnknownProperties - Setting this to true will cause this method to ignore IllegalArgumentException exceptions that occur from attempting to set the value of an unknown property via reflection.

getJavaBean

public t getJavaBean()
Retrieve the JavaBean wrapped by this JavabeanWrapper.

Returns:
The JavaBean wrapped by this JavabeanWrapper.