Class ChangeTrackingIndirectMultilingualString
- All Implemented Interfaces:
IndirectWrapper
,Serializable
MultilingualString
so that calls to modifying operations are intercepted and reported to the
persistence context (if necessary).- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionChangeTrackingIndirectMultilingualString
(Object owner, Field f, UnitOfWork uow, MultilingualString referencedString) Create new indirect multilingual string backed by the specified referencedMultilingualString
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks whether this string contains value in the specified language.boolean
Checks whether this string contains a simple literal value.boolean
get()
Gets the value of a simple literal represented by this instance.Gets value for the specified language.Gets the set of languages for which translations exist in the instance.getValue()
Gets the translations contained in this instance as a map of language-value pairs.int
hashCode()
boolean
isEmpty()
Checks whether this instance does not contain any language representations (including a simple literal).void
Removes translation in the specified language.Sets value without language.Sets value in the specified language.toString()
unwrap()
Retrieves the wrapped object.Methods inherited from class cz.cvut.kbss.jopa.model.MultilingualString
create
-
Constructor Details
-
ChangeTrackingIndirectMultilingualString
public ChangeTrackingIndirectMultilingualString(Object owner, Field f, UnitOfWork uow, MultilingualString referencedString) Create new indirect multilingual string backed by the specified referencedMultilingualString
.- Parameters:
owner
- Owner of the stringf
- The field holding this stringuow
- Persistence context the owner belongs toreferencedString
- The string to reference- Throws:
NullPointerException
- If thereferencedString
is null
-
-
Method Details
-
set
Description copied from class:MultilingualString
Sets value in the specified language.This overrides any previous value in the specified language, if it existed.
- Overrides:
set
in classMultilingualString
- Parameters:
language
- Language to use with the specified value. Passingnull
has the same effect asMultilingualString.set(String)
value
- String value in the specified language- Returns:
- This instance
- See Also:
-
set
Description copied from class:MultilingualString
Sets value without language.That is, the specified value will be stored as a simple literal (type xsd:string).
- Overrides:
set
in classMultilingualString
- Parameters:
value
- Value to set- Returns:
- This instance
- See Also:
-
get
Description copied from class:MultilingualString
Gets value for the specified language.If no language is specified, either the simple literal value is returned (if present), or any other existing value is returned. However, note that, in case of missing simple literal, repeated calls may return values in different languages. If there are no translations,
null
is returned.- Overrides:
get
in classMultilingualString
- Parameters:
language
- Requested language (language tag). Can benull
- Returns:
- Value of this string for the specified language (or
null
if not available)
-
get
Description copied from class:MultilingualString
Gets the value of a simple literal represented by this instance.If this instances does not represent a simple literal, any other existing value is returned. However, note that in that case repeated calls may return values in different languages.
If this object is empty (i.e., neither simple literal nor any translations are available),
null
is returned.- Overrides:
get
in classMultilingualString
- Returns:
- Value of simple literal represented by this string
-
contains
Description copied from class:MultilingualString
Checks whether this string contains value in the specified language.If no language is specified (argument is
null
), this method will returntrue
if there is value without language tag (simple literal) or in any other language.- Overrides:
contains
in classMultilingualString
- Parameters:
language
- Requested language (language tag)- Returns:
true
if this string exists in the specified language
-
containsSimple
public boolean containsSimple()Description copied from class:MultilingualString
Checks whether this string contains a simple literal value.That is, whether this instance contains a value without a language tag.
- Overrides:
containsSimple
in classMultilingualString
- Returns:
true
if and only if this string exists as a simple literal
-
isEmpty
public boolean isEmpty()Description copied from class:MultilingualString
Checks whether this instance does not contain any language representations (including a simple literal).- Overrides:
isEmpty
in classMultilingualString
- Returns:
true
if no translations exist in this instance
-
remove
Description copied from class:MultilingualString
Removes translation in the specified language.Passing in
null
will remove the simple literal contained in this instance.- Overrides:
remove
in classMultilingualString
- Parameters:
language
- Language for which translation should be removed
-
getLanguages
Description copied from class:MultilingualString
Gets the set of languages for which translations exist in the instance.Note that the result may contain
null
, indicating a simple literal.- Overrides:
getLanguages
in classMultilingualString
- Returns:
- Set of languages available in this multilingual string
-
getValue
Description copied from class:MultilingualString
Gets the translations contained in this instance as a map of language-value pairs.Convenience method for accessing all values at once. Note that this method returns the actual value used by this instance, so any changes to it will be reflected in the instance's behavior. It is not a general purpose method, rather a way to access and manipulate the underlying data structure more efficiently when necessary.
- Overrides:
getValue
in classMultilingualString
- Returns:
- Map of language to translation values
-
equals
- Overrides:
equals
in classMultilingualString
-
hashCode
public int hashCode()- Overrides:
hashCode
in classMultilingualString
-
toString
- Overrides:
toString
in classMultilingualString
-
unwrap
Description copied from interface:IndirectWrapper
Retrieves the wrapped object.- Specified by:
unwrap
in interfaceIndirectWrapper
- Returns:
- The wrapped object
-