Class AliasUpdateImpl
java.lang.Object
org.wikidata.wdtk.datamodel.implementation.AliasUpdateImpl
- All Implemented Interfaces:
AliasUpdate
Jackson implementation of
AliasUpdate.-
Field Summary
Fields inherited from interface org.wikidata.wdtk.datamodel.interfaces.AliasUpdate
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionAliasUpdateImpl(List<MonolingualTextValue> recreated, List<MonolingualTextValue> added, Collection<MonolingualTextValue> removed) Initializes new alias update. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetAdded()Returns aliases added in this update.Returns language code of aliases in this update.Returns the new list of aliases that completely replaces current aliases.Returns aliases removed in this update.inthashCode()booleanisEmpty()Checks whether the update is empty.
-
Constructor Details
-
AliasUpdateImpl
public AliasUpdateImpl(List<MonolingualTextValue> recreated, List<MonolingualTextValue> added, Collection<MonolingualTextValue> removed) Initializes new alias update. This update applies to aliases in one language only. Callers should specify eitherrecreatedparameter oraddedandremovedparameters, because combination of the two update approaches is not possible. To remove all aliases, pass empty list inrecreatedparameter.- Parameters:
recreated- new list of aliases that completely replaces the old ones ornullto not recreate aliasesadded- aliases added in this update or empty collection for no additionsremoved- aliases removed in this update or empty collection for no removals- Throws:
NullPointerException- ifadded,removed, or any alias isnullIllegalArgumentException- if given invalid combination of parameters
-
-
Method Details
-
isEmpty
public boolean isEmpty()Description copied from interface:AliasUpdateChecks whether the update is empty. Empty update will not alter alias list in any way.- Specified by:
isEmptyin interfaceAliasUpdate- Returns:
trueif the update is empty,falseotherwise
-
getLanguageCode
Description copied from interface:AliasUpdateReturns language code of aliases in this update. Language code is only available for non-empty updates.- Specified by:
getLanguageCodein interfaceAliasUpdate- Returns:
- alias language code or
Optional.empty()when the update is empty
-
getRecreated
Description copied from interface:AliasUpdateReturns the new list of aliases that completely replaces current aliases. If this list is present, then the update contains no added/removed aliases.- Specified by:
getRecreatedin interfaceAliasUpdate- Returns:
- new list of aliases or
Optional.empty()if aliases are not being recreated
-
getAdded
Description copied from interface:AliasUpdateReturns aliases added in this update. If there are any added aliases, thenAliasUpdate.getRecreated()must returnOptional.empty(). It is however possible to add and remove aliases in the same update.- Specified by:
getAddedin interfaceAliasUpdate- Returns:
- added aliases
-
getRemoved
Description copied from interface:AliasUpdateReturns aliases removed in this update. If there are any removed aliases, thenAliasUpdate.getRecreated()must returnOptional.empty(). It is however possible to add and remove aliases in the same update.- Specified by:
getRemovedin interfaceAliasUpdate- Returns:
- removed aliases
-
equals
-
hashCode
public int hashCode()
-