Class StatementDocumentUpdateBuilder
java.lang.Object
org.wikidata.wdtk.datamodel.helpers.EntityUpdateBuilder
org.wikidata.wdtk.datamodel.helpers.StatementDocumentUpdateBuilder
- Direct Known Subclasses:
FormUpdateBuilder
,LabeledDocumentUpdateBuilder
,LexemeUpdateBuilder
,SenseUpdateBuilder
Builder for incremental construction of
StatementDocumentUpdate
objects.- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
StatementDocumentUpdateBuilder
(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 StatementDocumentUpdate
build()
Creates newStatementDocumentUpdate
object with contents of this builder object.forBaseRevision
(StatementDocument revision) Creates new builder object for constructing update of given base entity revision.forBaseRevisionId
(EntityIdValue entityId, long revisionId) Creates new builder object for constructing update of entity with given revision ID.forEntityId
(EntityIdValue entityId) Creates new builder object for constructing update of entity with given ID.updateStatements
(StatementUpdate update) Updates entity statements.Methods inherited from class org.wikidata.wdtk.datamodel.helpers.EntityUpdateBuilder
forBaseRevision
-
Constructor Details
-
StatementDocumentUpdateBuilder
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
-
StatementDocumentUpdateBuilder
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 StatementDocumentUpdateBuilder forBaseRevisionId(EntityIdValue entityId, long revisionId) Creates new builder object for constructing update of entity with given revision ID.Supported entity IDs include
ItemIdValue
,PropertyIdValue
,LexemeIdValue
,FormIdValue
,SenseIdValue
, 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
,LexemeIdValue
,FormIdValue
,SenseIdValue
, 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
,LexemeDocument
,FormDocument
,SenseDocument
, 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
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.- Parameters:
update
- statement update, possibly empty- Returns:
this
(fluent method)- Throws:
NullPointerException
- ifupdate
isnull
IllegalArgumentException
- if replaced or removed statement is not present in current entity revision (if available)
-
build
Creates newStatementDocumentUpdate
object with contents of this builder object.- Specified by:
build
in classEntityUpdateBuilder
- Returns:
- constructed object
-