public interface Representation
Yard (the storage of the Entityhub). Reference and Text. PRO: clearer API CON: more Objects
to be garbage collected.| Modifier and Type | Method and Description |
|---|---|
void |
add(String field,
Object value)
Adds the object as value to the field.
|
void |
addNaturalText(String field,
String text,
String... languages)
Adds a natural language text as value for one or more languages
|
void |
addReference(String field,
String reference)
Adds an reference to the field.
|
Iterator<Object> |
get(String field)
Getter for all values for the requested field
|
<T> Iterator<T> |
get(String field,
Class<T> type)
Getter for all values of a field
|
Iterator<Text> |
get(String field,
String... language)
Getter for all natural language text values of a field
|
Iterator<String> |
getFieldNames()
Getter for all the present fields
|
Object |
getFirst(String field)
Getter for the (first) value for a field
|
<T> T |
getFirst(String field,
Class<T> type)
Getter for a single Value for a field
|
Text |
getFirst(String field,
String... language)
Getter for the first natural language text value of a specific language
|
Reference |
getFirstReference(String field)
Getter for the first reference value for a field
|
String |
getId()
Getter for the identifier.
|
Iterator<Reference> |
getReferences(String field)
Getter for all reference values of a field
|
Iterator<Text> |
getText(String field)
Getter for all natural language text values of a field
|
void |
remove(String field,
Object value)
Removes the parsed value form the field.
|
void |
removeAll(String field)
Removes all values of the field
|
void |
removeAllNaturalText(String field,
String... languages)
Removes all natural language texts for the given languages or all natural
language labels of no language or an empty array is parsed as language.
|
void |
removeNaturalText(String field,
String text,
String... languages)
Removes a natural language text in given languages form a field
|
void |
removeReference(String field,
String reference)
Removes to parsed reference as value for the given field.
|
void |
set(String field,
Object value)
Sets the value of the field to the parsed object.
|
void |
setNaturalText(String field,
String text,
String... language)
Setter for the natural language text value of a field in the given
languages.
|
void |
setReference(String field,
String reference)
Setter for the reference of a field.
|
String getId()
<T> T getFirst(String field, Class<T> type) throws UnsupportedTypeException, IllegalArgumentException
T - the generic type the returned valuefield - the fieldtype - the type of the valuesIllegalArgumentException - if the type is not supportedIllegalArgumentException - if null or an empty string
is parsed as fieldUnsupportedTypeException<T> Iterator<T> get(String field, Class<T> type) throws UnsupportedTypeException, IllegalArgumentException
T - the generic type of the returned valuesfield - the fieldtype - the typeUnsupportedTypeException - if the parsed type is not supportedIllegalArgumentException - if null or an empty string
is parsed as fieldObject getFirst(String field) throws IllegalArgumentException
field - the fieldIllegalArgumentException - if null or an empty string
is parsed as fieldReference getFirstReference(String field) throws IllegalArgumentException
field - the fieldIllegalArgumentException - if null or an empty string
is parsed as fieldText getFirst(String field, String... language) throws IllegalArgumentException
field - the fieldlanguage - the language(s) of the natural language text value
(If null is parsed as language, than also labels
without language tag are included in the Result)IllegalArgumentException - if null or an empty string
is parsed as fieldIterator<Object> get(String field) throws IllegalArgumentException
field - the fieldIllegalArgumentException - if null or an empty string
is parsed as fieldIterator<Text> getText(String field) throws IllegalArgumentException
field - the fieldIllegalArgumentException - if null or an empty string
is parsed as fieldIterator<Text> get(String field, String... language) throws IllegalArgumentException
field - the fieldlanguage - the language(s) of the natural language text value
(If null is parsed as language, than also labels
without language tag are included in the Result)IllegalArgumentException - if null or an empty string
is parsed as fieldIterator<Reference> getReferences(String field) throws IllegalArgumentException
field - the fieldIllegalArgumentException - if null or an empty string
is parsed as fieldvoid add(String field, Object value) throws IllegalArgumentException
The type of the value is inferred based on the type of the Object.
Supported Types are:
Reference
Reference instances are created for such valuesDate
Text
Text with the language=nullCollections, Enumerations and Iterators are
can be used to parse multiple values
field - the fieldvalue - the value to addNullPointerExceptionIllegalArgumentException - if null is parsed as field or
value and/or if an empty string is parsed as fieldvoid addReference(String field, String reference) throws IllegalArgumentException
field - the fieldreference - the string representation of the reference. Note that
the value will be interpreted as a "reference" so there might apply
some rules about the format of the string. Regardless of the implementation
any valid URI and URL need to be accepted as a valid reference valueNullPointerExceptionIllegalArgumentException - if null or an empty string
is parsed as field or referencevoid addNaturalText(String field, String text, String... languages) throws IllegalArgumentException
field - the field to add the text as valuetext - the natural language textlanguage - the text is set for all the parsed languages. Parse
null to set the text also without any language
information.NullPointerExceptionIllegalArgumentException - if null or an empty string
is parsed as field; if null is parsed as text.
NOTE that null is supported for languages.void set(String field, Object value) throws IllegalArgumentException
null than this method removes all values for the given
fieldadd(String, Object) for
details.field - the fieldvalue - the new value for the fieldNullPointerExceptionIllegalArgumentException - if null or an empty string
is parsed as fieldvoid setReference(String field, String reference) throws IllegalArgumentException
null than this method removes all values for the given
field.field - the fieldreference - the string representation of the reference. Note that
the value will be interpreted as a "reference" so there might apply
some rules about the format of the string. Regardless of the implementation
any valid URI and URL need to be accepted as a valid reference valueIllegalArgumentException - if nullor an emtpy string is
parsed as fieldvoid setNaturalText(String field, String text, String... language) throws IllegalArgumentException
null is parsed as text, all present values
for the parsed languages are removed (values of other languages are
not removed)field - the fieldtext - the natural language textlanguage - the languages of the parsed text. Parse
null to set the text also without any language
information.IllegalArgumentException - if nullor an emtpy string is
parsed as fieldvoid remove(String field, Object value) throws IllegalArgumentException
null is parsed
as value than the call is ignored.
This methods follows the same conventions as add(String, Object)
(e.g. parsing a Collection will cause all values within this
collection to be removed). See the documentation of add(String, Object)
for details.
field - the fieldvalue - the value to removeIllegalArgumentException - if nullor an emtpy string is
parsed as fieldvoid removeReference(String field, String reference) throws NullPointerException, IllegalArgumentException
null
is parsed as reference, that the call is ignored.field - the fieldreference - the string representation of the reference. Note that
the value will be interpreted as a "reference" so there might apply
some rules about the format of the string. Regardless of the implementation
any valid URI and URL need to be accepted as a valid reference valueNullPointerException - if null is parsed as fieldIllegalArgumentException - if an empty string is parsed as fieldvoid removeNaturalText(String field, String text, String... languages) throws IllegalArgumentException
field - the fieldtext - the natural language textlanguage - the language(s) of the natural language text
(If null is parsed as language, than also labels
without language tag might be removed)IllegalArgumentException - if nullor an emtpy string is
parsed as fieldvoid removeAll(String field) throws IllegalArgumentException
field - the fieldIllegalArgumentException - if nullor an emtpy string is
parsed as fieldvoid removeAllNaturalText(String field, String... languages) throws IllegalArgumentException
null as entry of the
languages array.field - the field.languages - the language(s) of the natural language text. If
null or an empty array is parsed, than all
natural language label are removed. To remove only labels with
no language, null needs to be parsed as entry of
this array.IllegalArgumentException - if nullor an emtpy string is
parsed as fieldCopyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.