Class Property<T,K>
java.lang.Object
com.codename1.properties.PropertyBase<T,K>
com.codename1.properties.Property<T,K>
- Direct Known Subclasses:
BooleanProperty, NumericProperty
Base class for a property, it can store a generic value of any type and broadcast change events to
external listeners
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a property with null valueConstructs a property with null valueConstructs a property with the given name and valueConstructs a property with the given name and value -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this property to another propertyget()Gets the property valueinthashCode()Returns the internal hashcode or 0 for null propertySets the property value and potentially fires a change eventtoString()Default toString that provides easier debug informationMethods inherited from class PropertyBase
addChangeListener, bindGlobalGetListener, bindGlobalSetListener, firePropertyChanged, getClientProperty, getGenericType, getLabel, getName, putClientProperty, removeChangeListener, setLabel, stopListening, validateCollectionTypeModifier and TypeMethodDescriptionvoidFires a notification that a property value changed to the given listenerstatic voidbindGlobalGetListener(PropertyChangeListener listener) Binds an event callback for get calls and property readsstatic voidbindGlobalSetListener(PropertyChangeListener listener) Binds an event callback for set calls and property mutationprotected voidDelivers the property change event to listeners if applicablegetClientProperty(String key) Returns the client property set to this property nameReturns the generic type of this property if it is known or nullgetLabel()The label of the property defaults to its name but can be changed to anythinggetName()The property name is immutable and can't be changed after creation it should match the parent field name by conventionvoidputClientProperty(String key, Object o) Places a property that will apply statically to all instances of this propertyvoidRemoves the property change listener from the list of listenersvoidThe label of the property defaults to its name but can be changed to anything, it can be used when binding a property to UI elementsvoidThis method will work when invoked from a propertyChanged callback and should be similar toremovePropertyChangeListener(this).protected final voidvalidateCollectionType(Class elementType) Validates that the collection type is valid and throws an exception otherwiseMethods inherited from class Object
clone, getClass, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()final ClassgetClass()Returns the runtime class of an object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(long timeout) Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.final voidwait(long timeout, int nanos) Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
-
Constructor Details
-
Property
-
Property
-
Property
Constructs a property with null value
Parameters
name: the name of the property
-
Property
-
-
Method Details
-
get
Gets the property value
Returns
the property value
-
set
-
equals
Compares this property to another property
Parameters
obj: the other property
Returns
true if they are equal in name and value
- Overrides:
equalsin classPropertyBase<T,K>
-
hashCode
public int hashCode()Returns the internal hashcode or 0 for null property
Returns
the hashcode value
- Overrides:
hashCodein classPropertyBase<T,K>
-
toString
Description copied from class:PropertyBaseDefault toString that provides easier debug information
Returns
a formatted representation of the property for debugging
- Overrides:
toStringin classPropertyBase<T,K>
-