|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibatis.common.beans.BeanProbe
BeanProbe is an instantiatable wrapper for any JavaBeans compliant object that allows simple reflective access to bean properties. All methods forward to equivalent methods in StaticBeanProbe. In some cases it may be easier to use this wrapper class instead of having to constantly pass the object references to the property accessor methods of StaticBeanProbe.
Examples:
BeanProbe probe = new BeanProbe(object);
probe.setObject(propertyName, value);
Object value = probe.getObject(propertyName);
Field Summary | |
private java.lang.Object |
object
|
Constructor Summary | |
BeanProbe(java.lang.Object obj)
Creates new BeanProbe to wrap a bean |
Method Summary | |
boolean |
beanEquals(java.lang.Object object2)
Compares a bean to the wrapped bean to see if it is equal - all properties are equal. |
boolean |
beanEquals(java.lang.Object object2,
java.lang.String[] properties)
Compares a bean to the wrapped bean to see if it is equal enough - the list of named properties are equal. |
int |
beanHashCode()
Calculates a hash code for all readable properties of the bean |
int |
beanHashCode(java.lang.String[] properties)
Calculates a hash code for a subset of the readable properties of a bean |
boolean |
equals(java.lang.Object obj)
Compares the beans to another |
boolean |
getBoolean(java.lang.String name)
Gets a boolean property |
byte |
getByte(java.lang.String name)
Gets a byte property |
char |
getCharacter(java.lang.String name)
Gets a char property |
java.util.Date |
getDate(java.lang.String name)
Gets a Date property |
double |
getDouble(java.lang.String name)
Gets a double property |
java.lang.Object |
getField(java.lang.String name)
Get an Object value from a field (property) |
float |
getFloat(java.lang.String name)
Gets a float property |
int |
getInteger(java.lang.String name)
Gets an Integer property |
long |
getLong(java.lang.String name)
Gets a long property |
java.lang.Object |
getObject(java.lang.String name)
Gets an Object property |
java.lang.Class |
getPropertyTypeForGetter(java.lang.String name)
Gets the type of a property based on the getter |
java.lang.Class |
getPropertyTypeForSetter(java.lang.String name)
Gets the type of a property based on the setter |
java.lang.String[] |
getReadablePropertyNames()
Returns an array of the names of the readable properties for the bean |
short |
getShort(java.lang.String name)
Gets a short property |
java.lang.String |
getString(java.lang.String name)
Gets a String property |
java.lang.String[] |
getWriteablePropertyNames()
Returns an array of the names of the writeable properties for the bean |
int |
hashCode()
Generates a hashcode for the bean |
boolean |
hasReadableProperty(java.lang.String propertyName)
Checks to see if a bean has a readable property by name |
boolean |
hasWritableProperty(java.lang.String propertyName)
Checks to see if a bean has a writeable property by name |
void |
setBoolean(java.lang.String name,
boolean value)
Sets a boolean property |
void |
setByte(java.lang.String name,
byte value)
Sets a byte property |
void |
setCharacter(java.lang.String name,
char value)
Sets a char property |
void |
setDate(java.lang.String name,
java.util.Date value)
Sets a Date property |
void |
setDouble(java.lang.String name,
double value)
Sets a double property |
void |
setField(java.lang.String name,
java.lang.Object value)
Set a field (property) to an Object value |
void |
setFloat(java.lang.String name,
float value)
Sets a float property |
void |
setInteger(java.lang.String name,
int value)
Sets an Integer property |
void |
setLong(java.lang.String name,
long value)
Sets a long property |
void |
setObject(java.lang.String name,
java.lang.Object value)
Sets an Object property |
void |
setShort(java.lang.String name,
short value)
Sets a short property |
void |
setString(java.lang.String name,
java.lang.String value)
Sets a String property |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.Object object
Constructor Detail |
public BeanProbe(java.lang.Object obj)
obj
- The bean to wrapMethod Detail |
public void setField(java.lang.String name, java.lang.Object value)
name
- Property namevalue
- New valuepublic java.lang.Object getField(java.lang.String name)
name
- Property name
public java.lang.String[] getReadablePropertyNames()
public java.lang.String[] getWriteablePropertyNames()
public boolean beanEquals(java.lang.Object object2)
object2
- The bean to compare
public boolean beanEquals(java.lang.Object object2, java.lang.String[] properties)
object2
- The bean to compareproperties
- The properties to test
public int beanHashCode()
public int beanHashCode(java.lang.String[] properties)
properties
- A list of the properties to hash
public java.lang.Class getPropertyTypeForSetter(java.lang.String name)
name
- Property name
public java.lang.Class getPropertyTypeForGetter(java.lang.String name)
name
- Property name
public java.lang.Object getObject(java.lang.String name)
name
- Property name
public void setObject(java.lang.String name, java.lang.Object value)
name
- Property namevalue
- New valuepublic java.lang.String getString(java.lang.String name)
name
- Property name
public void setString(java.lang.String name, java.lang.String value)
name
- Property namevalue
- New valuepublic int getInteger(java.lang.String name)
name
- Property name
public void setInteger(java.lang.String name, int value)
name
- Property namevalue
- New valuepublic long getLong(java.lang.String name)
name
- Property name
public void setLong(java.lang.String name, long value)
name
- Property namevalue
- New valuepublic short getShort(java.lang.String name)
name
- Property name
public void setShort(java.lang.String name, short value)
name
- Property namevalue
- New valuepublic byte getByte(java.lang.String name)
name
- Property name
public void setByte(java.lang.String name, byte value)
name
- Property namevalue
- New valuepublic char getCharacter(java.lang.String name)
name
- Property name
public void setCharacter(java.lang.String name, char value)
name
- Property namevalue
- New valuepublic double getDouble(java.lang.String name)
name
- Property name
public void setDouble(java.lang.String name, double value)
name
- Property namevalue
- New valuepublic float getFloat(java.lang.String name)
name
- Property name
public void setFloat(java.lang.String name, float value)
name
- Property namevalue
- New valuepublic boolean getBoolean(java.lang.String name)
name
- Property name
public void setBoolean(java.lang.String name, boolean value)
name
- Property namevalue
- New valuepublic java.util.Date getDate(java.lang.String name)
name
- Property name
public void setDate(java.lang.String name, java.util.Date value)
name
- Property namevalue
- New valuepublic boolean hasWritableProperty(java.lang.String propertyName)
propertyName
- The property to look for
public boolean hasReadableProperty(java.lang.String propertyName)
propertyName
- The property to look for
public int hashCode()
public boolean equals(java.lang.Object obj)
obj
- The bean to compare
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |