Class Property


  • public class Property
    extends Object
    A named property with a value and a description.
    Author:
    Fabio Simeoni
    • Constructor Detail

      • Property

        public Property​(String name,
                        Object value)
        Creates an instance with a given name and value.
        Parameters:
        name - the name
        value - the value
      • Property

        public Property​(String name,
                        Object value,
                        String description)
        Creates an instance with a given name, value, and description.
        Parameters:
        name - the name
        value - the value
        description - the description
    • Method Detail

      • name

        public String name()
        Returns the name of this property.
        Returns:
        the name
      • display

        public void display​(boolean display)
        Sets whether the property is intended for display
        Parameters:
        display - true if the property is intended for display
      • isDisplay

        public boolean isDisplay()
        Returns true if the property is intended for display
        Returns:
        true if the property is intended for display
      • value

        public Object value()
        Returns the value of this property.
        Returns:
        the value
      • value

        public <S> S value​(Class<S> type)
        Returns the value of this property under a given type.
        Returns:
        the value
        Throws:
        IllegalStateException - if the value cannot be returned under the given type.
      • is

        public boolean is​(Class<?> type)
        Returns true if the value of this property has a given type.
        Parameters:
        type - the type
        Returns:
        true if the value of this property has a given type
      • description

        public String description()
        Returns the description of this property.
        Returns:
        the description
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object