org.directwebremoting.extend
Interface Property

All Known Implementing Classes:
ConstructorProperty, FieldProperty, H2PropertyDescriptorProperty, H3PropertyDescriptorProperty, NestedProperty, OverrideProperty, ParameterProperty, PlainProperty, PropertyDescriptorProperty

public interface Property

Describes some way to get or set a bit of data on an object.

There are obvious Properties for a getter/setter pair PropertyDescriptorProperty, for a field FieldProperty and also for a constructor parameter ConstructorProperty. There is a PlainProperty for when we have a collection of Properties of a bean, but need to augment it in some way and NestedProperty which is used when we're digging into nested generic type info. It would be nice if PropertyDescriptor, and the various reflection types like Member had a common supertype, but they don't. In a way this is it.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Method Summary
 Property createChild(int index)
          Properties may have children where we have nested generic type info.
 java.lang.String getName()
          Gets the name of this property
 java.lang.Class<?> getPropertyType()
          What type does this property
 java.lang.Object getValue(java.lang.Object bean)
          Get the value of this property of the passed in java bean
 void setValue(java.lang.Object bean, java.lang.Object value)
          Set the value of this property of the passed in java bean
 

Method Detail

getName

java.lang.String getName()
Gets the name of this property

Returns:
The property name

getPropertyType

java.lang.Class<?> getPropertyType()
What type does this property

Returns:
The type of object that will be returned by getValue(Object)

getValue

java.lang.Object getValue(java.lang.Object bean)
                          throws ConversionException
Get the value of this property of the passed in java bean

Parameters:
bean - The bean to introspect
Returns:
The value assigned to this property of the passed in bean
Throws:
ConversionException - If the reflection access fails

setValue

void setValue(java.lang.Object bean,
              java.lang.Object value)
              throws ConversionException
Set the value of this property of the passed in java bean

Parameters:
bean - The bean to introspect
value - The value assigned to this property of the passed in bean
Throws:
ConversionException - If the reflection access fails

createChild

Property createChild(int index)
Properties may have children where we have nested generic type info. For example with setFoo(List<Map<String, Class<?>> x) we can find type information about the nested bits of generic data.

If calling this method then you almost certainly want to check for an overridden property as defined by the ConverterManager by calling ConverterManager.checkOverride(Property)

Parameters:
index - Generally the parameter offset.
Returns:
A Property to describe the nested bit of data

Copyright 2008