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
ConstructorDescriptionAliasUpdateImpl
(List<MonolingualTextValue> recreated, List<MonolingualTextValue> added, Collection<MonolingualTextValue> removed) Initializes new alias update. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getAdded()
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.int
hashCode()
boolean
isEmpty()
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 eitherrecreated
parameter oradded
andremoved
parameters, because combination of the two update approaches is not possible. To remove all aliases, pass empty list inrecreated
parameter.- Parameters:
recreated
- new list of aliases that completely replaces the old ones ornull
to 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 isnull
IllegalArgumentException
- if given invalid combination of parameters
-
-
Method Details
-
isEmpty
public boolean isEmpty()Description copied from interface:AliasUpdate
Checks whether the update is empty. Empty update will not alter alias list in any way.- Specified by:
isEmpty
in interfaceAliasUpdate
- Returns:
true
if the update is empty,false
otherwise
-
getLanguageCode
Description copied from interface:AliasUpdate
Returns language code of aliases in this update. Language code is only available for non-empty updates.- Specified by:
getLanguageCode
in interfaceAliasUpdate
- Returns:
- alias language code or
Optional.empty()
when the update is empty
-
getRecreated
Description copied from interface:AliasUpdate
Returns 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:
getRecreated
in interfaceAliasUpdate
- Returns:
- new list of aliases or
Optional.empty()
if aliases are not being recreated
-
getAdded
Description copied from interface:AliasUpdate
Returns 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:
getAdded
in interfaceAliasUpdate
- Returns:
- added aliases
-
getRemoved
Description copied from interface:AliasUpdate
Returns 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:
getRemoved
in interfaceAliasUpdate
- Returns:
- removed aliases
-
equals
-
hashCode
public int hashCode()
-