com.miginfocom.property
Class FieldPropertyInfo<T>

java.lang.Object
  extended by com.miginfocom.property.PropertyInfo<T>
      extended by com.miginfocom.property.FieldPropertyInfo<T>

public class FieldPropertyInfo<T>
extends PropertyInfo<T>

Extends PropertyInfo to also include a reference to a Field.

Sub classes should always be immutable since this class is typically cached.

See Also:
BeanProperty

Constructor Summary
FieldPropertyInfo(java.lang.reflect.Field field, Transfer set, Transfer get, boolean modifiable, FirePolicy fire, java.util.List<? extends Validator<T>> validators, java.lang.String[] groups, boolean observable)
          Constructor.
 
Method Summary
 java.lang.reflect.Field getField()
          Returns the Field that is holding this property in the bean.
 java.util.List<java.lang.reflect.Type> getGenericTypes()
          Returns the types that the proeprty was created with.
 FieldProperty getProperty(java.lang.Object bean)
          Helper method to get the actual property object from the bean.
 java.lang.String toString()
           
 
Methods inherited from class com.miginfocom.property.PropertyInfo
getFirePolicy, getGetPolicy, getGroups, getSetPolicy, getValidators, hasValidators, isGroup, isModifiable, isObservable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FieldPropertyInfo

public FieldPropertyInfo(java.lang.reflect.Field field,
                         Transfer set,
                         Transfer get,
                         boolean modifiable,
                         FirePolicy fire,
                         java.util.List<? extends Validator<T>> validators,
                         java.lang.String[] groups,
                         boolean observable)
Constructor.

Parameters:
field - The field that holds this property. Never null.
set - The policy for set operations. Never null.
get - The policy for get operations. Never null.
modifiable - If the value's content can be changes. For instance the add and remove for a CollectionProperty.
fire - The policy how to compare old and new values to know when to fire change events. Never null.
validators - Optinal validators. May be null if no vaidators.
groups - Optinal goups. May be null if no vaidators.
observable - If this property's value can be observed. If true then net.java.properties.PropertyI#addPropertyListener(net.java.properties.PropertyListener) and net.java.properties.PropertyI#removePropertyListener(net.java.properties.PropertyListener) must be implmented.
Method Detail

getField

public final java.lang.reflect.Field getField()
Returns the Field that is holding this property in the bean.

Returns:
The Field that is holding this property in the bean. Never null.

getGenericTypes

public final java.util.List<java.lang.reflect.Type> getGenericTypes()
Returns the types that the proeprty was created with. It is the Class types between > and <.

Note that this is the generic type of the declared field and if it is a cast to a raw type with for instance:

public final Property mapProperty = new MapProperty();

There will be no generic types as they are not saved for runtime. This is how Java works.

Returns:
The types that the proeprty was created with. Never null. Will be of length 0 in some circumstances.

getProperty

public final FieldProperty getProperty(java.lang.Object bean)
                                throws java.lang.IllegalAccessException
Helper method to get the actual property object from the bean.

Parameters:
bean - The bean that holds the property.
Returns:
The actual property object from the bean.
Throws:
java.lang.IllegalAccessException - If the field could not be accesses reflectively.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2007 MiG InfoCom AB. All Rights Reserved.