public class Property<T, K>
- Object
- PropertyBase<T, K>
- Property
Known subtypesBooleanProperty, NumericProperty
Base class for a property, it can store a generic value of any type and broadcast change events to
external listeners
Constructors
public Property(String name, T value) | Constructs a property with the given name and value |
public Property(String name, Class genericType, T value) | Constructs a property with the given name and value |
public Property(String name) | Constructs a property with null value |
public Property(String name, Class genericType) | Constructs a property with null value |
Methods
public T get() | Gets the property value |
public K set(T value) | Sets the property value and potentially fires a change event |
public boolean equals(Object obj) | Compares this property to another property |
public int hashCode() | Returns the internal hashcode or 0 for null property |
public String toString() | Default toString that provides easier debug information |
Inherited methods
Constructor details
Property
public Property(String name, T value)Constructs a property with the given name and value
Parameters
nameString- the name of the property
valueT- the default value for the property
Property
public Property(String name, Class genericType, T value)Constructs a property with the given name and value
Parameters
nameString- the name of the property
genericTypeClass- the type of the property
valueT- the default value for the property
Property
public Property(String name)Constructs a property with null value
Parameters
nameString- the name of the property
Property
public Property(String name, Class genericType)Constructs a property with null value
Parameters
nameString- the name of the property
genericTypeClass- the type of the property
Method details
get
public T get()Gets the property value
Returns
the property value
set
public K set(T value)Sets the property value and potentially fires a change event
Parameters
valueT- the new value
equals
public boolean equals(Object obj)Compares this property to another property
Parameters
objObject- the other property
Returns
true if they are equal in name and value
hashCode
public int hashCode()Returns the internal hashcode or 0 for null property
Returns
the hashcode value
toString
public String toString()Default toString that provides easier debug information
Returns
a formatted representation of the property for debugging