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
ModifierConstructorDescriptionprotected
LabeledDocumentUpdateBuilder
(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 LabeledStatementDocumentUpdate
build()
Creates newLabeledStatementDocumentUpdate
object with contents of this builder object.static LabeledDocumentUpdateBuilder
forBaseRevision
(LabeledStatementDocument revision) Creates new builder object for constructing update of given base entity revision.static LabeledDocumentUpdateBuilder
forBaseRevisionId
(EntityIdValue entityId, long revisionId) Creates new builder object for constructing update of entity with given revision ID.static LabeledDocumentUpdateBuilder
forEntityId
(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
forBaseRevision
Methods 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
- ifentityId
isnull
IllegalArgumentException
- ifentityId
is 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
- ifrevision
isnull
IllegalArgumentException
- ifrevision
has 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
- 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
,PropertyIdValue
, andMediaInfoIdValue
.- 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
,PropertyDocument
, andMediaInfoDocument
.- 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 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
- ifupdate
isnull
-
build
Creates newLabeledStatementDocumentUpdate
object with contents of this builder object.- Specified by:
build
in classStatementDocumentUpdateBuilder
- Returns:
- constructed object
-