org.gcube.common.ghn.service.context
Class Property

java.lang.Object
  extended by org.gcube.common.ghn.service.context.Property

public class Property
extends Object

A named property with a value and a description.

Author:
Fabio Simeoni

Constructor Summary
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
 String description()
          Returns the description of this property.
 void display(boolean display)
          Sets whether the property is intended for display
 boolean equals(Object obj)
           
 int hashCode()
           
 boolean is(Class<?> type)
          Returns true if the value of this property has a given type.
 boolean isDisplay()
          Returns true if the property is intended for display
 String name()
          Returns the name of this property.
 String toString()
           
 Object value()
          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 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

equals

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

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.