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 TypeMethodDescriptionbooleanChecks whether this string contains value in the specified language.booleanChecks whether this string contains a simple literal value.booleanget()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.inthashCode()booleanisEmpty()Checks whether this instance does not contain any language representations (including a simple literal).voidRemoves 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 thereferencedStringis null
-
-
Method Details
-
set
Description copied from class:MultilingualStringSets value in the specified language.This overrides any previous value in the specified language, if it existed.
- Overrides:
setin classMultilingualString- Parameters:
language- Language to use with the specified value. Passingnullhas the same effect asMultilingualString.set(String)value- String value in the specified language- Returns:
- This instance
- See Also:
-
set
Description copied from class:MultilingualStringSets value without language.That is, the specified value will be stored as a simple literal (type xsd:string).
- Overrides:
setin classMultilingualString- Parameters:
value- Value to set- Returns:
- This instance
- See Also:
-
get
Description copied from class:MultilingualStringGets 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,
nullis returned.- Overrides:
getin classMultilingualString- Parameters:
language- Requested language (language tag). Can benull- Returns:
- Value of this string for the specified language (or
nullif not available)
-
get
Description copied from class:MultilingualStringGets 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),
nullis returned.- Overrides:
getin classMultilingualString- Returns:
- Value of simple literal represented by this string
-
contains
Description copied from class:MultilingualStringChecks whether this string contains value in the specified language.If no language is specified (argument is
null), this method will returntrueif there is value without language tag (simple literal) or in any other language.- Overrides:
containsin classMultilingualString- Parameters:
language- Requested language (language tag)- Returns:
trueif this string exists in the specified language
-
containsSimple
public boolean containsSimple()Description copied from class:MultilingualStringChecks whether this string contains a simple literal value.That is, whether this instance contains a value without a language tag.
- Overrides:
containsSimplein classMultilingualString- Returns:
trueif and only if this string exists as a simple literal
-
isEmpty
public boolean isEmpty()Description copied from class:MultilingualStringChecks whether this instance does not contain any language representations (including a simple literal).- Overrides:
isEmptyin classMultilingualString- Returns:
trueif no translations exist in this instance
-
remove
Description copied from class:MultilingualStringRemoves translation in the specified language.Passing in
nullwill remove the simple literal contained in this instance.- Overrides:
removein classMultilingualString- Parameters:
language- Language for which translation should be removed
-
getLanguages
Description copied from class:MultilingualStringGets the set of languages for which translations exist in the instance.Note that the result may contain
null, indicating a simple literal.- Overrides:
getLanguagesin classMultilingualString- Returns:
- Set of languages available in this multilingual string
-
getValue
Description copied from class:MultilingualStringGets 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:
getValuein classMultilingualString- Returns:
- Map of language to translation values
-
equals
- Overrides:
equalsin classMultilingualString
-
hashCode
public int hashCode()- Overrides:
hashCodein classMultilingualString
-
toString
- Overrides:
toStringin classMultilingualString
-
unwrap
Description copied from interface:IndirectWrapperRetrieves the wrapped object.- Specified by:
unwrapin interfaceIndirectWrapper- Returns:
- The wrapped object
-