Class LabeledDocumentUpdateBuilder
java.lang.Object
org.wikidata.wdtk.datamodel.helpers.EntityUpdateBuilder
org.wikidata.wdtk.datamodel.helpers.StatementDocumentUpdateBuilder
org.wikidata.wdtk.datamodel.helpers.LabeledDocumentUpdateBuilder
- Direct Known Subclasses:
MediaInfoUpdateBuilder,TermedDocumentUpdateBuilder
Builder for incremental construction of
LabeledStatementDocumentUpdate objects.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLabeledDocumentUpdateBuilder(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 LabeledStatementDocumentUpdatebuild()Creates newLabeledStatementDocumentUpdateobject with contents of this builder object.static LabeledDocumentUpdateBuilderforBaseRevision(LabeledStatementDocument revision) Creates new builder object for constructing update of given base entity revision.static LabeledDocumentUpdateBuilderforBaseRevisionId(EntityIdValue entityId, long revisionId) Creates new builder object for constructing update of entity with given revision ID.static LabeledDocumentUpdateBuilderforEntityId(EntityIdValue entityId) Creates new builder object for constructing update of entity with given ID.updateLabels(TermUpdate update) Updates entity labels.updateStatements(StatementUpdate update) Updates entity statements.Methods inherited from class org.wikidata.wdtk.datamodel.helpers.StatementDocumentUpdateBuilder
forBaseRevisionMethods inherited from class org.wikidata.wdtk.datamodel.helpers.EntityUpdateBuilder
forBaseRevision
-
Constructor Details
-
LabeledDocumentUpdateBuilder
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
-
LabeledDocumentUpdateBuilder
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 LabeledDocumentUpdateBuilder forBaseRevisionId(EntityIdValue entityId, long revisionId) Creates new builder object for constructing update of entity with given revision ID.Supported entity IDs include
ItemIdValue,PropertyIdValue, andMediaInfoIdValue.- 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
ItemIdValue,PropertyIdValue, andMediaInfoIdValue.- 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
ItemDocument,PropertyDocument, andMediaInfoDocument.- 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 classStatementDocumentUpdateBuilder- Parameters:
update- statement update, possibly empty- Returns:
this(fluent method)
-
updateLabels
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.- Parameters:
update- changes in entity labels- Returns:
this(fluent method)- Throws:
NullPointerException- ifupdateisnull
-
build
Creates newLabeledStatementDocumentUpdateobject with contents of this builder object.- Specified by:
buildin classStatementDocumentUpdateBuilder- Returns:
- constructed object
-