Class TermedDocumentUpdateBuilder
java.lang.Object
org.wikidata.wdtk.datamodel.helpers.EntityUpdateBuilder
org.wikidata.wdtk.datamodel.helpers.StatementDocumentUpdateBuilder
org.wikidata.wdtk.datamodel.helpers.LabeledDocumentUpdateBuilder
org.wikidata.wdtk.datamodel.helpers.TermedDocumentUpdateBuilder
- Direct Known Subclasses:
ItemUpdateBuilder
,PropertyUpdateBuilder
Builder for incremental construction of
TermedStatementDocumentUpdate
objects.-
Constructor Summary
ModifierConstructorDescriptionprotected
TermedDocumentUpdateBuilder
(EntityIdValue entityId, long revisionId) Initializes new builder object for constructing update of entity with given ID.protected
Initializes new builder object for constructing update of given base entity revision. -
Method Summary
Modifier and TypeMethodDescriptionabstract TermedStatementDocumentUpdate
build()
Creates newTermedStatementDocumentUpdate
object with contents of this builder object.static TermedDocumentUpdateBuilder
forBaseRevision
(TermedStatementDocument revision) Creates new builder object for constructing update of given base entity revision.static TermedDocumentUpdateBuilder
forBaseRevisionId
(EntityIdValue entityId, long revisionId) Creates new builder object for constructing update of entity with given revision ID.static TermedDocumentUpdateBuilder
forEntityId
(EntityIdValue entityId) Creates new builder object for constructing update of entity with given ID.updateAliases
(String language, AliasUpdate update) Updates entity aliases.updateDescriptions
(TermUpdate update) Updates entity descriptions.updateLabels
(TermUpdate update) Updates entity labels.updateStatements
(StatementUpdate update) Updates entity statements.Methods inherited from class org.wikidata.wdtk.datamodel.helpers.LabeledDocumentUpdateBuilder
forBaseRevision
Methods inherited from class org.wikidata.wdtk.datamodel.helpers.StatementDocumentUpdateBuilder
forBaseRevision
Methods inherited from class org.wikidata.wdtk.datamodel.helpers.EntityUpdateBuilder
forBaseRevision
-
Constructor Details
-
TermedDocumentUpdateBuilder
Initializes new builder object for constructing update of entity with given ID.- Parameters:
entityId
- ID of the entity that is to be updatedrevisionId
- ID of the base entity revision to be updated or zero if not available- Throws:
NullPointerException
- ifentityId
isnull
IllegalArgumentException
- ifentityId
is a placeholder ID
-
TermedDocumentUpdateBuilder
Initializes new builder object for constructing update of given base entity revision.- Parameters:
revision
- base entity revision to be updated- Throws:
NullPointerException
- ifrevision
isnull
IllegalArgumentException
- ifrevision
has placeholder ID
-
-
Method Details
-
forBaseRevisionId
public static TermedDocumentUpdateBuilder forBaseRevisionId(EntityIdValue entityId, long revisionId) Creates new builder object for constructing update of entity with given revision ID.Supported entity IDs include
ItemIdValue
andPropertyIdValue
.- Parameters:
entityId
- ID of the entity that is to be updatedrevisionId
- ID of the base entity revision to be updated or zero if not available- Returns:
- builder object matching entity type
- Throws:
NullPointerException
- ifentityId
isnull
IllegalArgumentException
- ifentityId
is of unrecognized type or it is a placeholder ID
-
forEntityId
Creates new builder object for constructing update of entity with given ID.Supported entity IDs include
ItemIdValue
andPropertyIdValue
.- Parameters:
entityId
- ID of the entity that is to be updated- Returns:
- builder object matching entity type
- Throws:
NullPointerException
- ifentityId
isnull
IllegalArgumentException
- ifentityId
is of unrecognized type or it is a placeholder ID
-
forBaseRevision
Creates new builder object for constructing update of given base entity revision. Provided entity document might not represent the latest revision of the entity as currently stored in Wikibase. It will be used for validation in builder methods. If the document has revision ID, it will be used to detect edit conflicts.Supported entity types include
ItemDocument
andPropertyDocument
.- Parameters:
revision
- base entity revision to be updated- Returns:
- builder object matching entity type
- Throws:
NullPointerException
- ifrevision
isnull
IllegalArgumentException
- ifrevision
is of unrecognized type or its ID is a placeholder ID
-
updateStatements
Description copied from class:StatementDocumentUpdateBuilder
Updates entity statements. If this method is called multiple times, changes are accumulated. If base entity revision was provided, the update is checked against it and redundant changes are silently ignored, resulting in empty update.- Overrides:
updateStatements
in classLabeledDocumentUpdateBuilder
- Parameters:
update
- statement update, possibly empty- Returns:
this
(fluent method)
-
updateLabels
Description copied from class:LabeledDocumentUpdateBuilder
Updates entity labels. If this method is called multiple times, changes are accumulated. If base entity revision was provided, redundant changes are silently ignored, resulting in empty update.- Overrides:
updateLabels
in classLabeledDocumentUpdateBuilder
- Parameters:
update
- changes in entity labels- Returns:
this
(fluent method)
-
updateDescriptions
Updates entity descriptions. If this method is called multiple times, changes are accumulated. If base entity revision was provided, redundant changes are silently ignored, resulting in empty update.- Parameters:
update
- changes in entity descriptions- Returns:
this
(fluent method)- Throws:
NullPointerException
- ifupdate
isnull
-
updateAliases
Updates entity aliases. If this method is called multiple times, changes are accumulated. If base entity revision was provided, the update is checked against it and redundant changes are silently ignored, resulting in empty update.- Parameters:
language
- language code of the altered aliasesupdate
- alias changes- Returns:
this
(fluent method)- Throws:
NullPointerException
- iflanguage
oraliases
isnull
IllegalArgumentException
- iflanguage
is blank oraliases
has inconsistent language code
-
build
Creates newTermedStatementDocumentUpdate
object with contents of this builder object.- Specified by:
build
in classLabeledDocumentUpdateBuilder
- Returns:
- constructed object
-