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
ConstructorsModifierConstructorDescriptionprotectedTermedDocumentUpdateBuilder(EntityIdValue entityId, long revisionId) Initializes new builder object for constructing update of entity with given ID.protectedInitializes new builder object for constructing update of given base entity revision. -
Method Summary
Modifier and TypeMethodDescriptionabstract TermedStatementDocumentUpdatebuild()Creates newTermedStatementDocumentUpdateobject with contents of this builder object.static TermedDocumentUpdateBuilderforBaseRevision(TermedStatementDocument revision) Creates new builder object for constructing update of given base entity revision.static TermedDocumentUpdateBuilderforBaseRevisionId(EntityIdValue entityId, long revisionId) Creates new builder object for constructing update of entity with given revision ID.static TermedDocumentUpdateBuilderforEntityId(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
forBaseRevisionMethods inherited from class org.wikidata.wdtk.datamodel.helpers.StatementDocumentUpdateBuilder
forBaseRevisionMethods 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- ifentityIdisnullIllegalArgumentException- ifentityIdis 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- ifrevisionisnullIllegalArgumentException- ifrevisionhas 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
ItemIdValueandPropertyIdValue.- 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- ifentityIdisnullIllegalArgumentException- ifentityIdis 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
ItemIdValueandPropertyIdValue.- Parameters:
entityId- ID of the entity that is to be updated- Returns:
- builder object matching entity type
- Throws:
NullPointerException- ifentityIdisnullIllegalArgumentException- ifentityIdis 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
ItemDocumentandPropertyDocument.- Parameters:
revision- base entity revision to be updated- Returns:
- builder object matching entity type
- Throws:
NullPointerException- ifrevisionisnullIllegalArgumentException- ifrevisionis of unrecognized type or its ID is a placeholder ID
-
updateStatements
Description copied from class:StatementDocumentUpdateBuilderUpdates 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:
updateStatementsin classLabeledDocumentUpdateBuilder- Parameters:
update- statement update, possibly empty- Returns:
this(fluent method)
-
updateLabels
Description copied from class:LabeledDocumentUpdateBuilderUpdates 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:
updateLabelsin 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- ifupdateisnull
-
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- iflanguageoraliasesisnullIllegalArgumentException- iflanguageis blank oraliaseshas inconsistent language code
-
build
Creates newTermedStatementDocumentUpdateobject with contents of this builder object.- Specified by:
buildin classLabeledDocumentUpdateBuilder- Returns:
- constructed object
-