|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.lonniepryor.blues.util.BeanHelper
Helper class that introspects and provides access to information about a JavaBean.
Constructor Summary | |
protected |
BeanHelper(java.lang.Class beanType)
Creates a new BeanHelper object. |
Method Summary | |
static void |
activateCache()
Activates the thread-local helper cache (must always be followed by a call to deactivateCache() ). |
boolean |
canWriteStringsTo(java.lang.String propertyName)
Returns true if the bean helper can write strings to the specified property. |
boolean |
clearProperty(java.lang.Object instance,
java.lang.String propertyName)
Clears the value of the named property on the specified instance. |
static void |
deactivateCache()
Deactivates the thread-local helper cache (must always be preceeded by a call to activateCache() ). |
boolean |
equals(java.lang.Object obj)
|
java.lang.Class |
getBeanType()
Returns the type of the bean. |
java.lang.Object |
getProperty(java.lang.Object instance,
java.lang.String propertyName)
Returns the value of the named property on the specified instance, or null if it is not found. |
java.lang.reflect.Method |
getPropertyAccessor(java.lang.String propertyName)
Returns the accessor method for the named property, or null if one is not found. |
java.lang.reflect.Method |
getPropertyMutator(java.lang.String propertyName)
Returns the mutator method for the named property, or null if one is not found. |
java.util.Set |
getPropertyNames()
Returns the names of all of the properties the bean type exposes. |
java.lang.Class |
getPropertyType(java.lang.String propertyName)
Returns the type of the named property, or null if one is not found. |
int |
hashCode()
|
static BeanHelper |
introspect(java.lang.Class beanType)
Introspects the specified bean class, using the local cache if one is active. |
static java.lang.Object |
invoke(java.lang.Object target,
java.lang.reflect.Method method,
java.lang.Object[] parameters)
Invokes the specified method on the supplied object. |
java.lang.Object |
newBeanInstance()
Creates a new instance of this helper's JavaBean class. |
boolean |
setProperty(java.lang.Object instance,
java.lang.String propertyName,
java.lang.Object propertyValue)
Sets the value of the named property on the specified instance. |
boolean |
setPropertyAsString(java.lang.Object instance,
java.lang.String propertyName,
java.lang.String propertyValue)
Sets the value of the named property on the specified instance as a string. |
static java.lang.Object |
stringToValue(java.lang.Class valueType,
java.lang.String string)
Converts a string into a basic value type. |
static java.lang.String |
toPropertyName(java.lang.reflect.Method method)
Determines the name of the property implied by the supplied method. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected BeanHelper(java.lang.Class beanType)
beanType
- The class of the bean.Method Detail |
public static java.lang.String toPropertyName(java.lang.reflect.Method method)
method
- The method to determine a property name for.
public static BeanHelper introspect(java.lang.Class beanType)
beanType
- The class of the bean.
public static void activateCache()
deactivateCache()
).
public static void deactivateCache()
activateCache()
).
public static java.lang.Object invoke(java.lang.Object target, java.lang.reflect.Method method, java.lang.Object[] parameters)
target
- The target to invoke on.method
- The method to invoke.parameters
- The parameters to pass.
public static java.lang.Object stringToValue(java.lang.Class valueType, java.lang.String string)
valueType
- The value type to convert to.string
- The string to convert.
public java.lang.Class getBeanType()
public java.util.Set getPropertyNames()
public java.lang.reflect.Method getPropertyAccessor(java.lang.String propertyName)
propertyName
- The name of the property.
public java.lang.reflect.Method getPropertyMutator(java.lang.String propertyName)
propertyName
- The name of the property.
public java.lang.Class getPropertyType(java.lang.String propertyName)
propertyName
- The name of the property.
public boolean canWriteStringsTo(java.lang.String propertyName)
propertyName
- The name of the property.
public java.lang.Object newBeanInstance()
public java.lang.Object getProperty(java.lang.Object instance, java.lang.String propertyName)
instance
- The instance to return the property value from.propertyName
- The name of the property to return.
public boolean setProperty(java.lang.Object instance, java.lang.String propertyName, java.lang.Object propertyValue)
instance
- The instance to set the property value on.propertyName
- The name of the property to set.propertyValue
- The value to set the property to.
public boolean setPropertyAsString(java.lang.Object instance, java.lang.String propertyName, java.lang.String propertyValue)
instance
- The instance to set the property value on.propertyName
- The name of the property to set.propertyValue
- The string value to set the property to.
public boolean clearProperty(java.lang.Object instance, java.lang.String propertyName)
instance
- The instance to clear the property value on.propertyName
- The name of the property to clear.
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |