|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.miginfocom.property.Property<T>
public class Property<T>
| Field Summary | |
|---|---|
protected static java.lang.Object |
UNINITIALIZED
|
| Constructor Summary | |
|---|---|
Property()
|
|
Property(T value)
|
|
| Method Summary | |
|---|---|
void |
addPropertyListener(PropertyListener<T> l)
Adds a listener to this property with a string reference. |
void |
addPropertyListener(java.lang.ref.WeakReference<PropertyListener<T>> wl)
Adds a listener to this property with a WeakReference. |
protected void |
checkInit()
|
protected T |
cloneObject(T value)
Clones the object. |
protected T |
create()
Lazily creates the value at first use if it was not set in the constructor. |
protected FieldPropertyInfo<T> |
createInfo()
Should create a FieldPropertyInfo every time. |
T |
get()
Returns the value of this property. |
java.lang.Object |
getBean()
Returns the bean that this property has at "parent". |
FieldPropertyInfo<T> |
getInfo()
Returns the PropertyInfo object that contains the metadata for this property. |
protected T |
getInternal()
This should be used to access the value internally as it will call create() if the value is uninitialized. |
java.lang.String |
getName()
|
void |
init(java.lang.Object bean)
Sets the bean that this property is a field in. |
protected void |
initNotify()
Called when the property has been properly initialized. |
boolean |
isNull()
|
protected T |
makeUnmodifiable(T value)
Makes the value unmodifiable, usually by wrapping it. |
void |
removePropertyListener(PropertyListener<T> l)
Removes the listener to this property. |
Result<T> |
set(T value)
Set the value of this property. |
protected void |
setInternal(T value)
This should be used to access the value internally. |
java.lang.String |
toString()
|
protected java.lang.Object |
writeReplace()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.Object UNINITIALIZED
| Constructor Detail |
|---|
public Property()
public Property(T value)
| Method Detail |
|---|
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException
java.io.ObjectStreamExceptionprotected T getInternal()
create() if the value is uninitialized.
To override this method means overriding the getting of the actualy value. Every access to the value will go through this method.
protected void setInternal(T value)
To override this method means overriding the setting of the actualy value. Every access to the value will go through this method.
value - The raw value that will be set. Can be set to UNINITIALIZED to unset the value where it will be recreated
the next time it is needed.protected T create()
null.
Should be overridden by sub classes to return default values.
It is a requirement that this method is only called a maximum of one time for an object instance.
null by default.public final java.lang.Object getBean()
FieldPropertyAny use of this property's value before the bean is set is illegal and will result in an exception.
getBean in interface FieldProperty<T>null if the bean
has not been set yet (i.e. it is not initialized).public final void init(java.lang.Object bean)
FieldPropertynull or change an already set bean should result in an exception.
Any use of the property before the bean is set is illegal and will result in an exception.
init in interface FieldProperty<T>bean - The bean. Never null.protected void initNotify()
Can be overridden to do property specific initialization.
public FieldPropertyInfo<T> getInfo()
PropertyInfo object that contains the metadata for this property. It should
normally be the same object that is cached since this method will be called often.
getInfo in interface FieldProperty<T>null.public java.lang.String getName()
protected FieldPropertyInfo<T> createInfo()
FieldPropertyInfo every time. It is cached
in getInfo(). getBean() will return a non-null value at the time
of this call.
PropertyHandler.getValidators(java.lang.reflect.Field) should probably be used to get
the standard set of Validators.
Override this method to create a custom FieldPropertyInfo.
null.public void addPropertyListener(PropertyListener<T> l)
l - The listener. Never null.
java.lang.UnsupportedOperationException - if PropertyInfo.isObservable() returns false.public void addPropertyListener(java.lang.ref.WeakReference<PropertyListener<T>> wl)
WeakReference. This means that the listener
will be unregistered when there is no other references to it. It also means that the caller must keep
a reference to the listener or it will be garbage collected, and thus unregistered, rights away. This
means that inline annonymous inner classes can not be used with this method.
wl - The listener. Never null.
java.lang.UnsupportedOperationException - if PropertyInfo.isObservable() returns false.public void removePropertyListener(PropertyListener<T> l)
l - The listener. Never null.
java.lang.UnsupportedOperationException - if PropertyInfo.isObservable() returns false.public T get()
PropertyInull.
get in interface PropertyI<T>public Result<T> set(T value)
PropertyInull.
set in interface PropertyI<T>value - The value.
Result.ok() if not special
logic for value checking is made.protected T makeUnmodifiable(T value)
Transfer.UNMODIFIABLE. Should be overridden by collection and map properties to wrap. Other property
type can also overrider this to make the value unmidifiable.
value - The value. May be null in which canse null should be returned.
java.lang.IllegalStateException - if the property does not support unmodifiable. This is also the default.protected T cloneObject(T value)
PropertyHandler.cloneObject(Object) which does a reflective lookup
for .clone() on the object.
value - The value to clone. May be null.
value.
java.lang.IllegalStateException - if the property does not support cloning.protected final void checkInit()
public boolean isNull()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||