public class Property<T, K>

  1. Object
  2. PropertyBase<T, K>
  3. 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

name String
the name of the property
value T
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

name String
the name of the property
genericType Class
the type of the property
value T
the default value for the property

Property

public Property(String name)
Constructs a property with null value

Parameters

name String
the name of the property

Property

public Property(String name, Class genericType)
Constructs a property with null value

Parameters

name String
the name of the property
genericType Class
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

value T
the new value

equals

public boolean equals(Object obj)
Compares this property to another property

Parameters

obj Object
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