|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.chwf.filter.BeanFilter
The BeanFilter
class is the abstract superclass
of all bean filters. Bean filters serve as an abstraction layer
facilitating string-to-data value conversions for Java Bean business
objects. Unlike the classes in the java.beans
packages,
the bean filter classes are designed for thread-safety, so that they
may be used in multi-thread application servers.
Field Summary | |
static java.lang.String |
ATTRIBUTE_DATATYPE
Standard name for the property's "datatype" attribute. |
static java.lang.String |
ATTRIBUTE_LABEL
Standard name for the property's "label" attribute. |
static java.lang.String |
ATTRIBUTE_MAX
Standard name for the property's "max" attribute. |
static java.lang.String |
ATTRIBUTE_MAXLENGTH
Standard name for the property's "maxlength" attribute. |
static java.lang.String |
ATTRIBUTE_MIN
Standard name for the property's "min" attribute. |
static java.lang.String |
ATTRIBUTE_MINLENGTH
Standard name for the property's "minlength" attribute. |
static java.lang.String |
ATTRIBUTE_OPTIONS
Standard name for the property's "options" attribute. |
static java.lang.String |
ATTRIBUTE_READONLY
Standard name for the property's "readonly" attribute. |
static java.lang.String |
ATTRIBUTE_REQUIRED
Standard name for the property's "required" attribute. |
static java.lang.String |
ATTRIBUTE_SCALE
Standard name for the property's "scale" attribute. |
static java.util.List |
KNOWN_ATTRIBUTES
List of known attribute names. |
Constructor Summary | |
protected |
BeanFilter(java.lang.Class beanClass)
Constructor to specify the class of filtered bean. |
Method Summary | |
java.lang.Object |
create()
Create a new object of the bean class. |
static BeanFilter |
findFilter(java.lang.Class beanClass)
Find the filter for a given class. |
static BeanFilter |
findFilter(java.lang.Object object)
Find the filter for a given object. |
static BeanFilter |
findFilter(java.lang.String className)
Find the filter for the specified class name. |
java.lang.String |
get(java.lang.Object object,
java.lang.String property)
Get the specified property value of the target object, as a string. |
java.lang.Class |
getBeanClass()
Get the bean class. |
static java.lang.Object |
getProperty(java.lang.Object owner,
java.lang.String property)
Returns property value as an object using its getter method. |
java.lang.Object |
getPropertyAsObject(java.lang.Object object,
java.lang.String property)
Get the specified property value of the target object, as an object. |
PropertyFilter |
getPropertyFilter(java.lang.String property)
Get a property filter for the specified property. |
PropertyFilter[] |
getPropertyFilters()
Get all property filters. |
protected void |
putPropertyAttribute(java.lang.String property,
java.lang.String attribute,
java.lang.Object value)
Put a property attribute value into a property filter. |
protected void |
putPropertyFilter(java.lang.String name,
PropertyFilter filter)
Put a property filter into this bean filter. |
void |
set(java.lang.Object object,
java.lang.String property,
java.lang.String value)
Set the specified property of the target object, using a string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String ATTRIBUTE_LABEL
public static final java.lang.String ATTRIBUTE_REQUIRED
public static final java.lang.String ATTRIBUTE_DATATYPE
public static final java.lang.String ATTRIBUTE_READONLY
public static final java.lang.String ATTRIBUTE_MIN
public static final java.lang.String ATTRIBUTE_MAX
public static final java.lang.String ATTRIBUTE_MINLENGTH
public static final java.lang.String ATTRIBUTE_MAXLENGTH
public static final java.lang.String ATTRIBUTE_SCALE
public static final java.lang.String ATTRIBUTE_OPTIONS
public static final java.util.List KNOWN_ATTRIBUTES
Constructor Detail |
protected BeanFilter(java.lang.Class beanClass)
super(beanClass);
beanClass
- The class of the filtered bean.Method Detail |
public static BeanFilter findFilter(java.lang.Object object) throws InitializationException
object
- The object being filtered.InitializationException
- If the filter cannot be initialized.public static BeanFilter findFilter(java.lang.Class beanClass) throws InitializationException
beanClass
- The class of the filtered bean.InitializationException
- If the filter cannot be initialized.public static BeanFilter findFilter(java.lang.String className) throws InitializationException
beanClass + "Filter"
. If it cannot
create this object, it creates a GenericBeanFilter
for the bean class using reflection.className
- This must be the fully qualified name of the class.InitializationException
- If the filter cannot be initialized.public java.lang.String get(java.lang.Object object, java.lang.String property) throws FilterException
object
- The target object.property
- The property being retrieved.FilterException
- For read failure.public java.lang.Object getPropertyAsObject(java.lang.Object object, java.lang.String property) throws FilterException
object
- The target object.property
- The property being retrieved.FilterException
- For read failure.public void set(java.lang.Object object, java.lang.String property, java.lang.String value) throws FilterException, ConversionException
object
- The target object.property
- The property being updated.value
- The new property value.FilterException
- For write failure.ConversionException
- If the value cannot be converted to
the correct type.public java.lang.Object create() throws java.lang.UnsupportedOperationException, OperationException
java.lang.UnsupportedOperationException
- If create is not supported
for this bean.OperationException
- If the create operation itself
throws an exception. The underlying exception is wrapped
in this one.public PropertyFilter getPropertyFilter(java.lang.String property) throws PropertyNotFoundException
property
- The property.PropertyNotFoundException
- If the bean does not have the property.public PropertyFilter[] getPropertyFilters()
public java.lang.Class getBeanClass()
protected void putPropertyFilter(java.lang.String name, PropertyFilter filter)
name
- The property name.filter
- The property filter.protected void putPropertyAttribute(java.lang.String property, java.lang.String attribute, java.lang.Object value) throws PropertyNotFoundException
property
- The property name.attribute
- The attribute name.value
- The attribute value.PropertyNotFoundException
- If the object does not have the property.public static java.lang.Object getProperty(java.lang.Object owner, java.lang.String property)
owner
- The owning object.property
- The bean property or null if it cannot be found.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |