Class Property

java.lang.Object
org.gcube.smartgears.context.Property

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

    Constructors
    Constructor
    Description
    Property(String name, Object value)
    Creates an instance with a given name and value.
    Property(String name, Object value, String description)
    Creates an instance with a given name, value, and description.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the description of this property.
    void
    display(boolean display)
    Sets whether the property is intended for display
    boolean
     
    int
     
    boolean
    is(Class<?> type)
    Returns true if the value of this property has a given type.
    boolean
    Returns true if the property is intended for display
    Returns the name of this property.
     
    Returns the value of this property.
    <S> S
    value(Class<S> type)
    Returns the value of this property under a given type.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • 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 Details

    • 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
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object