com.miginfocom.property
Class PropertyHandler

java.lang.Object
  extended by com.miginfocom.property.PropertyHandler

public class PropertyHandler
extends java.lang.Object


Field Summary
static boolean VALIDATION_EXCEPTIONS
           
 
Constructor Summary
PropertyHandler()
           
 
Method Summary
static void addBeanListener(java.lang.Object bean, PropertyListener l)
          Adds listening to the bean for property changes ion its FieldPropertys.
static void addBeanListener(java.lang.Object bean, java.lang.ref.WeakReference<PropertyListener> wl)
          Adds listening to the bean for property changes ion its FieldPropertys.
static
<T> void
addPropertyListener(FieldProperty<T> p, PropertyListener<T> l)
          Adds listening to the property for value changes.
static
<T> void
addPropertyListener(FieldProperty<T> p, java.lang.ref.WeakReference<PropertyListener<T>> wl)
          Adds listening to the property for value changes.
static void addValidatorFactory(ValidatorFactory factory)
          Adds a factory that will be asked to optionally return a validator for every new property field encountered.
static
<T> void
fireCollectionPropertyChange(CollectionProperty<T> p, PropertyEvent.Type type, T removedElement, T addedElement, Result result)
           
static
<T> void
fireIndexedPropertyChange(ListProperty<T> p, PropertyEvent.Type type, T removedElement, T addedElement, Result result, java.lang.Integer ix)
           
static
<K,V> void
fireMapPropertyChange(MapProperty<K,V> p, PropertyEvent.Type type, java.util.Map.Entry<K,V> removedElement, java.util.Map.Entry<K,V> addedElement, Result result)
           
static
<T> void
firePropertyBeanChange(PropertyEvent sourceEvent, FieldProperty<T> p)
           
static
<T> void
firePropertyChange(FieldProperty<T> p, PropertyEvent.Type type, T oldValue, T newValue, Result result)
           
static java.util.ArrayList<? extends Validator> getValidators(java.lang.reflect.Field field)
           
static boolean hasListeners()
          Should only be uncommented for unit tests.
static void init(java.lang.Object bean)
           
static void removeBeanListener(java.lang.Object bean, PropertyListener l)
           
static
<T> void
removePropertyListener(FieldProperty<T> p, PropertyListener<T> l)
           
static boolean removeValidatorFactory(ValidatorFactory factory)
          Adds a factory that will be asked to optionally return a validator for every new property field encountered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATION_EXCEPTIONS

public static boolean VALIDATION_EXCEPTIONS
Constructor Detail

PropertyHandler

public PropertyHandler()
Method Detail

addValidatorFactory

public static final void addValidatorFactory(ValidatorFactory factory)
Adds a factory that will be asked to optionally return a validator for every new property field encountered.

Parameters:
factory - The factory. Never null.

removeValidatorFactory

public static final boolean removeValidatorFactory(ValidatorFactory factory)
Adds a factory that will be asked to optionally return a validator for every new property field encountered.

Parameters:
factory - The factory. Never null.
Returns:
If the factory was removed.

getValidators

public static java.util.ArrayList<? extends Validator> getValidators(java.lang.reflect.Field field)

addPropertyListener

public static <T> void addPropertyListener(FieldProperty<T> p,
                                           PropertyListener<T> l)
Adds listening to the property for value changes.

The property is held in a weak reference so it will be garbage collected when there are no more strong references to it. See WeakReference.

Parameters:
p - The property to listen for value changes on.
l - The listener to add.

addPropertyListener

public static <T> void addPropertyListener(FieldProperty<T> p,
                                           java.lang.ref.WeakReference<PropertyListener<T>> wl)
Adds listening to the property for value changes.

The property is held in a weak reference so it will be garbage collected when there are no more strong references to it. See WeakReference.

Parameters:
p - The property to listen for value changes on.
wl - The listener to add as a WeakReference. It is held in a weak reference so it will be garbage collected when there are no more strong references to it. See WeakReference. This means that it the caller needs to keep a strong reference to it or it will be garbage collected right away.

removePropertyListener

public static <T> void removePropertyListener(FieldProperty<T> p,
                                              PropertyListener<T> l)

addBeanListener

public static void addBeanListener(java.lang.Object bean,
                                   PropertyListener l)
Adds listening to the bean for property changes ion its FieldPropertys.

The bean is held in a weak reference so it will be garbage collected when there are no more strong references to it. See WeakReference.

Parameters:
bean - The bean to listen for property changes on its FieldPropertys.
l - The listener to add.

addBeanListener

public static void addBeanListener(java.lang.Object bean,
                                   java.lang.ref.WeakReference<PropertyListener> wl)
Adds listening to the bean for property changes ion its FieldPropertys.

The bean is held in a weak reference so it will be garbage collected when there are no more strong references to it. See WeakReference.

Parameters:
bean - The bean to listen for property changes on its FieldPropertys.
wl - The listener to add as a WeakReference. It is held in a weak reference so it will be garbage collected when there are no more strong references to it. See WeakReference. This means that it the caller needs to keep a strong reference to it or it will be garbage collected right away.

removeBeanListener

public static void removeBeanListener(java.lang.Object bean,
                                      PropertyListener l)

hasListeners

public static boolean hasListeners()
Should only be uncommented for unit tests.


firePropertyChange

public static <T> void firePropertyChange(FieldProperty<T> p,
                                          PropertyEvent.Type type,
                                          T oldValue,
                                          T newValue,
                                          Result result)

firePropertyBeanChange

public static <T> void firePropertyBeanChange(PropertyEvent sourceEvent,
                                              FieldProperty<T> p)

fireCollectionPropertyChange

public static <T> void fireCollectionPropertyChange(CollectionProperty<T> p,
                                                    PropertyEvent.Type type,
                                                    T removedElement,
                                                    T addedElement,
                                                    Result result)

fireMapPropertyChange

public static <K,V> void fireMapPropertyChange(MapProperty<K,V> p,
                                               PropertyEvent.Type type,
                                               java.util.Map.Entry<K,V> removedElement,
                                               java.util.Map.Entry<K,V> addedElement,
                                               Result result)

fireIndexedPropertyChange

public static <T> void fireIndexedPropertyChange(ListProperty<T> p,
                                                 PropertyEvent.Type type,
                                                 T removedElement,
                                                 T addedElement,
                                                 Result result,
                                                 java.lang.Integer ix)

init

public static void init(java.lang.Object bean)


Copyright © 2007 MiG InfoCom AB. All Rights Reserved.