info.sswap.http.representation
Class Entity

java.lang.Object
  extended by info.sswap.http.representation.ValueBase
      extended by info.sswap.http.representation.Entity
All Implemented Interfaces:
Value

public class Entity
extends ValueBase

Represents an entity (e.g., subject, object, etc.)

Author:
Blazej Bulka

Field Summary
private  java.util.Map<java.lang.String,Property> properties
          The multi-map of properties.
private  java.lang.String uri
          The URI of the entity
 
Constructor Summary
Entity(java.lang.String uri)
          Creates a new entity without properties, but with the specified URI.
Entity(java.lang.String uri, java.util.Collection<Property> properties)
          Creates a new entity with the specified uri and properties
 
Method Summary
 void addProperty(Property property)
          Adds a new property
 Entity asEntity()
          Returns the value as an entity
 Property getProperty(java.lang.String name)
          Gets all the properties with the given name (URI).
 java.util.Collection<java.lang.String> getPropertyNames()
          Returns all current property names (URIs)
 java.lang.String getURI()
          Gets the URI of this entity.
 boolean isEntity()
          Checks whether this value is an entity.
 
Methods inherited from class info.sswap.http.representation.ValueBase
asArray, asBoolean, asDouble, asInteger, asLiteral, asString, isArray, isBoolean, isDouble, isInteger, isLiteral
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uri

private java.lang.String uri
The URI of the entity


properties

private java.util.Map<java.lang.String,Property> properties
The multi-map of properties. The keys are property names, and the values are lists of properties.

Constructor Detail

Entity

public Entity(java.lang.String uri)
Creates a new entity without properties, but with the specified URI.

Parameters:
uri - the uri for the entity

Entity

public Entity(java.lang.String uri,
              java.util.Collection<Property> properties)
Creates a new entity with the specified uri and properties

Parameters:
uri - the uri for the entity
properties - the properties for the entity
Method Detail

getPropertyNames

public java.util.Collection<java.lang.String> getPropertyNames()
Returns all current property names (URIs)

Returns:
a collection of all currently known property names.

addProperty

public void addProperty(Property property)
Adds a new property

Parameters:
property - the property to be added

getProperty

public Property getProperty(java.lang.String name)
Gets all the properties with the given name (URI).

Parameters:
name - the name of the property (URI)
Returns:
a property or null

getURI

public java.lang.String getURI()
Gets the URI of this entity.

Returns:
the URI of this entity

isEntity

public boolean isEntity()
Description copied from interface: Value
Checks whether this value is an entity.

Specified by:
isEntity in interface Value
Overrides:
isEntity in class ValueBase
Returns:
true if this value is an entity

asEntity

public Entity asEntity()
Description copied from interface: Value
Returns the value as an entity

Specified by:
asEntity in interface Value
Overrides:
asEntity in class ValueBase
Returns:
the representation of this value as an entity


Copyright (c) 2010, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.