eu.planets_project.services.datatypes
Class Property

java.lang.Object
  extended by eu.planets_project.services.datatypes.Property
All Implemented Interfaces:
java.io.Serializable

public final class Property
extends java.lang.Object
implements java.io.Serializable

Property representation using an URI as ID.

For the most common case (a property with ID, name and value), use the Property(URI, String, String) constructor:

Property p = new Property(uri, name, value);

Only the ID is actually required. To create properties with less or more attributes, use a Property.Builder:

Property p = new Property.Builder(uri).unit(unit).build();

Instances of this class are immutable and so can be shared.

See Also:
Serialized Form

Nested Class Summary
static class Property.Builder
          Builder to create property instances with optional attributes.
 
Constructor Summary
Property(java.net.URI uri, java.lang.String name, java.lang.String value)
          Create a property with id, name and value.
 
Method Summary
static Property authorizedRoles(java.lang.String roles)
          This is a convenience method, equivalent to "new Property(ServiceDescription.PROPERTY, ServiceDescription.AUTHORIZED_ROLES, roles)".
 boolean equals(java.lang.Object obj)
          
 java.lang.String getDescription()
           
 java.lang.String getName()
           
 java.lang.String getType()
           
 java.lang.String getUnit()
           
 java.net.URI getUri()
           
 java.lang.String getValue()
           
 int hashCode()
          
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Property

public Property(java.net.URI uri,
                java.lang.String name,
                java.lang.String value)
Create a property with id, name and value. To create properties with less or more attributes, use a Property.Builder instead.

Parameters:
uri - The property ID
name - The property name
value - The property value
Method Detail

getUri

public java.net.URI getUri()
Returns:
the uri

getName

public java.lang.String getName()
Returns:
the name

getValue

public java.lang.String getValue()
Returns:
the value

getUnit

public java.lang.String getUnit()
Returns:
the unit

getDescription

public java.lang.String getDescription()
Returns:
the description

getType

public java.lang.String getType()
Returns:
the type

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

authorizedRoles

public static Property authorizedRoles(java.lang.String roles)
This is a convenience method, equivalent to "new Property(ServiceDescription.PROPERTY, ServiceDescription.AUTHORIZED_ROLES, roles)".

Parameters:
roles - The authorized roles, comma-separated (e.g. "admin,provider")
Returns:
A property to be used to indicate the given roles are authenticated (e.g. in a ServiceDescription)


Copyright © 2007-2010 The Planets Consortium. All Rights Reserved.