public class SurfObject extends Object
SURF objects are considered equal if their tags, type handles, IDs, and property handles and values are equal.
| Constructor and Description |
|---|
SurfObject()
Constructor of a object with no tag and an unknown type.
|
SurfObject(String typeHandle)
Optional type handle constructor.
|
SurfObject(String typeHandle,
String id)
Type handle and optional ID constructor.
|
SurfObject(URI tag)
Optional tag constructor.
|
SurfObject(URI tag,
String typeHandle)
Optional tag and optional type handle constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearProperties()
Removes all properties.
|
boolean |
equals(Object object) |
Optional<String> |
getId()
Returns the ID, if any, of the object for its type.
|
Iterable<Map.Entry<String,Object>> |
getProperties() |
int |
getPropertyCount() |
Optional<Object> |
getPropertyValue(String propertyHandle)
Retrieves the value of a property by the property handle.
|
Optional<URI> |
getTag() |
Optional<String> |
getTypeHandle() |
boolean |
hasDescription() |
int |
hashCode() |
void |
setProperties(Map<String,?> properties)
Sets property values from a map of property handles and values.
|
Optional<Object> |
setPropertyValue(String propertyHandle,
Object value)
Sets a property value by the property handle.
|
public SurfObject()
public SurfObject(@Nullable URI tag)
tag - The identifying object tag, or null if not known.IllegalArgumentException - if a tag is given that is not an absolute IRI.public SurfObject(@Nullable URI tag, @Nullable String typeHandle)
tag - The identifying object tag, or null if not known.typeHandle - The handle of the object type, or null if not known.IllegalArgumentException - if a tag is given that is not an absolute URI.IllegalArgumentException - if the given type handle is not a valid SURF handle.public SurfObject(@Nullable String typeHandle)
typeHandle - The handle of the object type, or null if not known.IllegalArgumentException - if the given type handle is not a valid SURF handle.public SurfObject(@Nonnull String typeHandle, @Nullable String id)
typeHandle - The handle of the object type.id - The object identifier unique for the object type.NullPointerException - if the given type handle is null.IllegalArgumentException - if the given type handle is not a valid SURF handle.public Optional<String> getTypeHandle()
public Optional<String> getId()
public int getPropertyCount()
public boolean hasDescription()
true if this object has at least one property.public Optional<Object> getPropertyValue(String propertyHandle)
propertyHandle - The handle of the property.public Optional<Object> setPropertyValue(String propertyHandle, Object value)
propertyHandle - The handle of the property.value - The new value of the property.IllegalArgumentException - if the given property handle does not conform to the rules for a SURF handle.public Iterable<Map.Entry<String,Object>> getProperties()
public void clearProperties()
public void setProperties(@Nonnull Map<String,?> properties)
null property handles nor null property values are
allowed.properties - The map of property handles and values.NullPointerException - if one or more of the given property handles or values is null.IllegalArgumentException - if one of the given property handles does not conform to the rules for a SURF handle.Copyright © 2007–2017 GlobalMentor, Inc.. All rights reserved.