|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jbeans.BaseBeanProperty | +--org.jbeans.BeanProperty
This class is used to describe, and manipulate JavaBean properties.
The properties that this class handles are normal properties and NOT
nested properties (see NestedBeanProperty
for more information on nested bean properties).
Field Summary | |
protected Method |
read
|
protected Method |
write
|
Fields inherited from class org.jbeans.BaseBeanProperty |
BAD_CONVERT, beanClass, conversionListeners, GET, POST_CONVERT, PRE_CONVERT, propertyListeners, propertyName, propertyType, SET |
Constructor Summary | |
protected |
BeanProperty()
Default constructor that can be used by sub-classes that want to delay the initialization of the propertyName and beanClass or that do not use these members. |
|
BeanProperty(String propertyName,
Class beanClass)
Constructs a new bean property using the property name and the bean class given. |
|
BeanProperty(String propertyName,
String beanClass)
Constructs a new bean property using the property name and the fully qualified name of the bean class given. |
Method Summary | |
Class |
getBeanClass()
Returns the bean class that the property is defined in |
Object |
getPropertyValue(Object bean)
Returns the value of the Java bean property for the given bean instance. |
Method |
getReadMethod()
Returns the read method of the bean property |
Method |
getWriteMethod()
Returns the write method name of the bean property |
protected void |
initialize()
Initializes the bean property by finding the read and write methods and setting up the propertyType for this BeanProperty. |
void |
setPropertyValue(Object bean,
Object value,
boolean convert)
Sets the value of the Java bean property to the given value |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Method read
protected Method write
Constructor Detail |
protected BeanProperty()
#initialize()
.public BeanProperty(String propertyName, Class beanClass) throws BeanException
If the bean class does not have a write method (set method) than the property is considered read-only. The bean class MUST have a read method (get method) or this method will throw and exception. This method calls the super-class constructor with the same signature.
propertyName
- The name of the JavaBean propertybeanClass
- The Class object used to find the read and write methods
for the JavaBean propertyBeanException
- If the property is invalid or does not exist in the
bean class givenpublic BeanProperty(String propertyName, String beanClass) throws BeanException
If the bean class does not have a write method (set method) than the property is considered read-only. The bean class MUST have a read method (get method) or this method will throw and exception. This method calls the super-class constructor with the same signature.
propertyName
- The name of the JavaBean propertybeanClass
- The fuly qualified name of the bean class object used to find
the read and write methods for the Java bean propertyBeanException
- If the property is invalid or does not exist in the
bean class givenMethod Detail |
protected void initialize() throws BeanException
initialize
in class BaseBeanProperty
BeanException
- If the bean class does not contain the propertypublic Class getBeanClass()
getBeanClass
in class BaseBeanProperty
public Method getReadMethod()
public Method getWriteMethod()
public Object getPropertyValue(Object bean) throws BeanException
getPropertyValue
in class BaseBeanProperty
bean
- The instance of the Java bean to retrieve the property fromBeanException
- If there was an error getting the Java bean property or
the getter/is method threw a checked Exceptionpublic void setPropertyValue(Object bean, Object value, boolean convert) throws BeanException, TypeConversionException
setPropertyValue
in class BaseBeanProperty
bean
- The instance of the Java bean to set the property onvalue
- The value to set the property toconvert
- Determines whether or not value should be converted
to the type that the setter requires or notBeanException
- If there was an error setting the Java bean property or
the setter method threw a checked ExceptionTypeConversionException
- If there was a problem auto-converting the
property value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |