public class StatementUpdateBuilder extends Object
StatementUpdate
objects.StatementDocumentUpdateBuilder
Modifier and Type | Method and Description |
---|---|
StatementUpdateBuilder |
add(Statement statement)
Adds statement to the entity.
|
StatementUpdateBuilder |
append(StatementUpdate update)
Replays all changes in provided update into this builder object.
|
StatementUpdate |
build()
Creates new
StatementUpdate object with contents of this builder
object. |
static StatementUpdateBuilder |
create()
Creates new builder object for constructing statement update.
|
static StatementUpdateBuilder |
create(EntityIdValue subject)
Creates new builder object for constructing statement update of given
subject.
|
static StatementUpdateBuilder |
forStatementGroups(Collection<StatementGroup> groups)
Creates new builder object for constructing update of given base revision
statement groups.
|
static StatementUpdateBuilder |
forStatementGroups(EntityIdValue subject,
Collection<StatementGroup> groups)
Creates new builder object for constructing update of given base revision
statement groups with given subject.
|
static StatementUpdateBuilder |
forStatements(Collection<Statement> statements)
Creates new builder object for constructing update of given base revision
statements.
|
static StatementUpdateBuilder |
forStatements(EntityIdValue subject,
Collection<Statement> statements)
Creates new builder object for constructing update of given base revision
statements with given subject.
|
StatementUpdateBuilder |
remove(String statementId)
Removes existing statement from the entity.
|
StatementUpdateBuilder |
replace(Statement statement)
Replaces existing statement in the entity.
|
public static StatementUpdateBuilder create()
public static StatementUpdateBuilder create(EntityIdValue subject)
subject
- statement subject or null
for unspecified IDIllegalArgumentException
- if subject is a placeholder IDpublic static StatementUpdateBuilder forStatements(Collection<Statement> statements)
Since all changes will be checked after the StatementUpdate
is passed
to EntityDocumentBuilder
anyway, it is usually unnecessary to use
this method. It is simpler to initialize the builder with create()
.
statements
- statements from base revision of the documentNullPointerException
- if statements
or any of its items is null
IllegalArgumentException
- if any statement is missing statement ID or statement subjects
are inconsistent or placeholderspublic static StatementUpdateBuilder forStatements(EntityIdValue subject, Collection<Statement> statements)
Since all changes will be checked after the StatementUpdate
is passed
to EntityDocumentBuilder
anyway, it is usually unnecessary to use
this method. It is simpler to initialize the builder with create()
.
subject
- statement subject or null
for unspecified IDstatements
- statements from base revision of the documentNullPointerException
- if statements
or any of its items is null
IllegalArgumentException
- if any statement is missing statement ID or statement subjects
are inconsistent or placeholderspublic static StatementUpdateBuilder forStatementGroups(Collection<StatementGroup> groups)
Since all changes will be checked after the StatementUpdate
is passed
to EntityDocumentBuilder
anyway, it is usually unnecessary to use
this method. It is simpler to initialize the builder with create()
.
groups
- statement groups from base revision of the documentNullPointerException
- if groups
is null
IllegalArgumentException
- if any group is null
or any statement is missing
statement ID or statement subjects are inconsistent or
placeholderspublic static StatementUpdateBuilder forStatementGroups(EntityIdValue subject, Collection<StatementGroup> groups)
Since all changes will be checked after the StatementUpdate
is passed
to EntityDocumentBuilder
anyway, it is usually unnecessary to use
this method. It is simpler to initialize the builder with create()
.
subject
- statement subject or null
for unspecified IDgroups
- statement groups from base revision of the documentNullPointerException
- if groups
is null
IllegalArgumentException
- if any group is null
or any statement is missing
statement ID or statement subjects are inconsistent or
placeholderspublic StatementUpdateBuilder add(Statement statement)
statement
has an ID (perhaps because
it is a modified copy of another statement), its ID is stripped to ensure the
statement is added and no other statement is modified.statement
- new statement to addthis
(fluent method)NullPointerException
- if statement
is null
IllegalArgumentException
- if statement's subject is inconsistent with other statements or
it is a placeholder IDpublic StatementUpdateBuilder replace(Statement statement)
statement
must
have statement ID identifying statement to replace. Calling this method
overrides any previous changes made to the same statement ID by this method
or remove(String)
.
If base revision statements were provided, existence of the statement is checked. Any attempt to replace some statement with identical statement is silently ignored, resulting in empty update.
statement
- replacement for existing statementthis
(fluent method)NullPointerException
- if statement
is null
IllegalArgumentException
- if statement
does not have statement ID or it is not
among base revision statements (if available) or its subject is
inconsistent with other statements or a placeholder IDpublic StatementUpdateBuilder remove(String statementId)
replace(Statement)
. Removing the same statement ID twice is silently
tolerated.
If base revision statements were provided, this method checks that statement with this ID exists in the base revision.
statementId
- ID of the removed statementthis
(fluent method)NullPointerException
- if statementId
is null
IllegalArgumentException
- if statementId
is empty or it is not among base revision
statements (if available)public StatementUpdateBuilder append(StatementUpdate update)
add(Statement)
,
replace(Statement)
, and remove(String)
methods.update
- statement update to replaythis
(fluent method)NullPointerException
- if update
is null
IllegalArgumentException
- if updated or removed statement is not among base revision
statements (if available)public StatementUpdate build()
StatementUpdate
object with contents of this builder
object.Copyright © 2014–2024 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage