|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Representation
This interface is used by the Entityhub to define representations. It is used for
any kind of CRUD operations on the Yard (the storage of the Entityhub).
The goal if this interface is to allow implementation based on different storage
solutions such as CMS, full text indices, triple stores, noSQL data stores ...
TODO: handling the differences between "NaturalLanguageText", "References" and
"normal" values feels to complex! Need to reevaluate if this differentiation
is needed or can be done in a more easy way!
TODO: add an API that allows to attach Content!
TODO: Do we need subNodes or are "references" enough.
TODO: Check to use also Wrappers for fields and values (in analogy to
Reference and Text. PRO: clearer API CON: more Objects
to be garbage collected.
| Method Summary | ||
|---|---|---|
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 |
|
|
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 |
|
|
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. |
|
| Method Detail |
|---|
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 values
IllegalArgumentException - if the type is not supported
IllegalArgumentException - if null or an empty string
is parsed as field
UnsupportedTypeException
<T> Iterator<T> get(String field,
Class<T> type)
throws UnsupportedTypeException,
IllegalArgumentException
T - the generic type of the returned valuesfield - the fieldtype - the type
UnsupportedTypeException - if the parsed type is not supported
IllegalArgumentException - if null or an empty string
is parsed as field
Object getFirst(String field)
throws IllegalArgumentException
field - the field
IllegalArgumentException - if null or an empty string
is parsed as field
Reference getFirstReference(String field)
throws IllegalArgumentException
field - the field
IllegalArgumentException - if null or an empty string
is parsed as field
Text 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 field
Iterator<Object> get(String field)
throws IllegalArgumentException
field - the field
IllegalArgumentException - if null or an empty string
is parsed as field
Iterator<Text> getText(String field)
throws IllegalArgumentException
field - the field
IllegalArgumentException - if null or an empty string
is parsed as field
Iterator<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 field
Iterator<Reference> getReferences(String field)
throws IllegalArgumentException
field - the field
IllegalArgumentException - if null or an empty string
is parsed as field
void 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 add
NullPointerException
IllegalArgumentException - if null is parsed as field or
value and/or if an empty string is parsed as field
void 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 value
NullPointerException
IllegalArgumentException - if null or an empty string
is parsed as field or reference
void 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.
NullPointerException
IllegalArgumentException - 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 field
NullPointerException
IllegalArgumentException - if null or an empty string
is parsed as field
void 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 value
IllegalArgumentException - if nullor an emtpy string is
parsed as field
void 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 field
void 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 remove
IllegalArgumentException - if nullor an emtpy string is
parsed as field
void 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 value
NullPointerException - if null is parsed as field
IllegalArgumentException - if an empty string is parsed as field
void 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 field
void removeAll(String field)
throws IllegalArgumentException
field - the field
IllegalArgumentException - if nullor an emtpy string is
parsed as field
void 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 fieldIterator<String> getFieldNames()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||