# Class Property<T,K>

java.lang.Object
com.codename1.properties.PropertyBase<T,K>
com.codename1.properties.Property<T,K>

Direct Known Subclasses:
  `BooleanProperty, NumericProperty`

public class Property<T,K> extends PropertyBase<T,K>
Base class for a property, it can store a generic value of any type and broadcast change events to external listeners

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Property(String name)`
  Constructs a property with null value
  `Property(String name, Class genericType)`
  Constructs a property with null value
  `Property(String name, Class genericType, T value)`
  Constructs a property with the given name and value
  `Property(String name, T value)`
  Constructs a property with the given name and value

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  Compares this property to another property
  `T`
  `get()`
  Gets the property value
  `int`
  `hashCode()`
  Returns the internal hashcode or 0 for null property
  `K`
  `set(T value)`
  Sets the property value and potentially fires a change event
  `String`
  `toString()`
  Default toString that provides easier debug information

  ### Methods inherited from class PropertyBase

  `addChangeListener, bindGlobalGetListener, bindGlobalSetListener, firePropertyChanged, getClientProperty, getGenericType, getLabel, getName, putClientProperty, removeChangeListener, setLabel, stopListening, validateCollectionType`

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### Property

    public Property(String name, T value)

    Constructs a property with the given name and value

    ###### Parameters

    - `name`: the name of the property

    - `value`: 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`: the name of the property

    - `genericType`: the type of the property

    - `value`: the default value for the property

  - ### Property

    public Property(String name)

    Constructs a property with null value

    ###### Parameters

    - `name`: the name of the property

  - ### Property

    public Property(String name, Class genericType)

    Constructs a property with null value

    ###### Parameters

    - `genericType`: the type of the property

    - `name`: the name 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`: the new value

  - ### equals

    public boolean equals(Object obj)

    Compares this property to another property

    ###### Parameters

    - `obj`: the other property

    ###### Returns

    true if they are equal in name and value

    Overrides:
      `equals` in class `PropertyBase<T,K>`

  - ### hashCode

    public int hashCode()

    Returns the internal hashcode or 0 for null property

    ###### Returns

    the hashcode value

    Overrides:
      `hashCode` in class `PropertyBase<T,K>`

  - ### toString

    public String toString()
    Description copied from class: `PropertyBase`

    Default toString that provides easier debug information

    ###### Returns

    a formatted representation of the property for debugging

    Overrides:
      `toString` in class `PropertyBase<T,K>`