Package org.jboss.util.property
Class MethodBoundPropertyListener
- java.lang.Object
-
- org.jboss.util.property.PropertyAdapter
-
- org.jboss.util.property.BoundPropertyAdapter
-
- org.jboss.util.property.MethodBoundPropertyListener
-
- All Implemented Interfaces:
java.util.EventListener
,BoundPropertyListener
,PropertyListener
public class MethodBoundPropertyListener extends BoundPropertyAdapter
Binds property values to class methods.- Version:
- $Revision$
-
-
Field Summary
Fields Modifier and Type Field Description protected java.beans.PropertyDescriptor
descriptor
Property descriptorprotected java.lang.Object
instance
Instance object that contains setter methodprotected java.lang.String
propertyName
Property name which we are bound toprotected java.lang.reflect.Method
setter
Property setter method
-
Constructor Summary
Constructors Constructor Description MethodBoundPropertyListener(java.lang.Object instance, java.lang.String propertyName)
Construct a MethodBoundPropertyListener.MethodBoundPropertyListener(java.lang.Object instance, java.lang.String propertyName, java.lang.String beanPropertyName)
Construct a MethodBoundPropertyListener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.beans.PropertyDescriptor
getPropertyDescriptor(java.lang.String beanPropertyName)
Get the PropertyDescriptor for the given bean property name.java.lang.String
getPropertyName()
Get the property name which this listener is bound to.protected void
invokeSetter(java.lang.String value)
Coerce and invoke the property setter method on the instance.void
propertyAdded(PropertyEvent event)
Notifies that a property has been added.void
propertyBound(PropertyMap map)
Notifies that this listener was bound to a property.void
propertyChanged(PropertyEvent event)
Notifies that a property has changed.-
Methods inherited from class org.jboss.util.property.BoundPropertyAdapter
propertyUnbound
-
Methods inherited from class org.jboss.util.property.PropertyAdapter
propertyRemoved
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.util.property.PropertyListener
propertyRemoved
-
-
-
-
Field Detail
-
propertyName
protected final java.lang.String propertyName
Property name which we are bound to
-
instance
protected final java.lang.Object instance
Instance object that contains setter method
-
setter
protected final java.lang.reflect.Method setter
Property setter method
-
descriptor
protected final java.beans.PropertyDescriptor descriptor
Property descriptor
-
-
Constructor Detail
-
MethodBoundPropertyListener
public MethodBoundPropertyListener(java.lang.Object instance, java.lang.String propertyName, java.lang.String beanPropertyName)
Construct a MethodBoundPropertyListener.- Parameters:
instance
- Instance object that contains setter method.propertyName
- The name of the property which will be bound.beanPropertyName
- The name of the property setter method.- Throws:
PropertyException
-
MethodBoundPropertyListener
public MethodBoundPropertyListener(java.lang.Object instance, java.lang.String propertyName)
Construct a MethodBoundPropertyListener.- Parameters:
instance
- Instance object that contains setter method.propertyName
- The name of the property which will be bound.
-
-
Method Detail
-
getPropertyDescriptor
private java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String beanPropertyName) throws java.beans.IntrospectionException
Get the PropertyDescriptor for the given bean property name.- Parameters:
beanPropertyName
- Bean property name.- Returns:
- PropertyDescriptor.
- Throws:
java.beans.IntrospectionException
-
getPropertyName
public final java.lang.String getPropertyName()
Get the property name which this listener is bound to.- Returns:
- Property name.
-
invokeSetter
protected void invokeSetter(java.lang.String value)
Coerce and invoke the property setter method on the instance.- Parameters:
value
- Method value.- Throws:
PropertyException
- Failed to invoke setter method.
-
propertyAdded
public void propertyAdded(PropertyEvent event)
Notifies that a property has been added.- Specified by:
propertyAdded
in interfacePropertyListener
- Overrides:
propertyAdded
in classPropertyAdapter
- Parameters:
event
- Property event.
-
propertyChanged
public void propertyChanged(PropertyEvent event)
Notifies that a property has changed.- Specified by:
propertyChanged
in interfacePropertyListener
- Overrides:
propertyChanged
in classPropertyAdapter
- Parameters:
event
- Property event.
-
propertyBound
public void propertyBound(PropertyMap map)
Notifies that this listener was bound to a property.- Specified by:
propertyBound
in interfaceBoundPropertyListener
- Overrides:
propertyBound
in classBoundPropertyAdapter
- Parameters:
map
- PropertyMap which contains property bound to.
-
-