Class PropertyDocumentBuilder
java.lang.Object
org.wikidata.wdtk.datamodel.helpers.AbstractDataObjectBuilder<T,O>
org.wikidata.wdtk.datamodel.helpers.EntityDocumentBuilder<PropertyDocumentBuilder,PropertyDocument>
org.wikidata.wdtk.datamodel.helpers.PropertyDocumentBuilder
public class PropertyDocumentBuilder
extends EntityDocumentBuilder<PropertyDocumentBuilder,PropertyDocument>
Builder class to construct
PropertyDocument
objects.- Author:
- Markus Kroetzsch
-
Constructor Summary
ModifierConstructorDescriptionprotected
PropertyDocumentBuilder
(PropertyDocument initialDocument) Constructor when building the property document from an existing one.protected
PropertyDocumentBuilder
(PropertyIdValue propertyIdValue, DatatypeIdValue datatype) Constructor when building the property document from scratch. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns theItemDocument
that has been built.static PropertyDocumentBuilder
forPropertyIdAndDatatype
(PropertyIdValue propertyIdValue, String datatypeId) Deprecated.static PropertyDocumentBuilder
forPropertyIdAndDatatype
(PropertyIdValue propertyIdValue, DatatypeIdValue datatype) Starts the construction of anPropertyDocument
with the given id.static PropertyDocumentBuilder
forPropertyIdAndJsonDatatype
(PropertyIdValue propertyIdValue, String datatypeId) Starts the construction of anPropertyDocument
with the given id.static PropertyDocumentBuilder
fromPropertyDocument
(PropertyDocument initialDocument) Starts the construction of anPropertyDocument
from the existing document.protected PropertyDocumentBuilder
getThis()
Returns the current object with the correct builder type.withEntityId
(EntityIdValue entityId) Changes the entity value id for the constructed document.Methods inherited from class org.wikidata.wdtk.datamodel.helpers.EntityDocumentBuilder
getStatementGroups, withAlias, withAlias, withDescription, withDescription, withLabel, withLabel, withRevisionId, withStatement
Methods inherited from class org.wikidata.wdtk.datamodel.helpers.AbstractDataObjectBuilder
prepareBuild
-
Constructor Details
-
PropertyDocumentBuilder
Constructor when building the property document from scratch.- Parameters:
propertyIdValue
- id of the newly constructed property documentdatatype
- the datatype of the newly constructed property document
-
PropertyDocumentBuilder
Constructor when building the property document from an existing one.- Parameters:
initialDocument
- the initial property document to start the build from
-
-
Method Details
-
forPropertyIdAndDatatype
public static PropertyDocumentBuilder forPropertyIdAndDatatype(PropertyIdValue propertyIdValue, DatatypeIdValue datatype) Starts the construction of anPropertyDocument
with the given id.- Parameters:
propertyIdValue
- id of the newly constructed property documentdatatype
- the datatype of the newly constructed property document- Returns:
- builder object to continue construction
-
fromPropertyDocument
Starts the construction of anPropertyDocument
from the existing document.- Parameters:
initialDocument
- the existing document to start the build from- Returns:
- builder object to continue construction
-
forPropertyIdAndDatatype
public static PropertyDocumentBuilder forPropertyIdAndDatatype(PropertyIdValue propertyIdValue, String datatypeId) Deprecated.Starts the construction of anPropertyDocument
with the given id.- Parameters:
propertyIdValue
- id of the newly constructed property documentdatatypeId
- the datatype id of the newly constructed property document, e.g.,DatatypeIdValue.DT_ITEM
.- Returns:
- builder object to continue construction
-
forPropertyIdAndJsonDatatype
public static PropertyDocumentBuilder forPropertyIdAndJsonDatatype(PropertyIdValue propertyIdValue, String datatypeId) Starts the construction of anPropertyDocument
with the given id.- Parameters:
propertyIdValue
- id of the newly constructed property documentdatatypeId
- the datatype id of the newly constructed property document, e.g.,DatatypeIdValue.DT_ITEM
.- Returns:
- builder object to continue construction
-
withEntityId
Changes the entity value id for the constructed document. SeeEntityDocument.getEntityId()
.- Overrides:
withEntityId
in classEntityDocumentBuilder<PropertyDocumentBuilder,
PropertyDocument> - Parameters:
entityId
- the entity id, which must be an ItemIdValue- Returns:
- builder object to continue construction
-
build
Returns theItemDocument
that has been built.- Specified by:
build
in classAbstractDataObjectBuilder<PropertyDocumentBuilder,
PropertyDocument> - Returns:
- constructed item document
- Throws:
IllegalStateException
- if the object was built already
-
getThis
Description copied from class:AbstractDataObjectBuilder
Returns the current object with the correct builder type.- Specified by:
getThis
in classAbstractDataObjectBuilder<PropertyDocumentBuilder,
PropertyDocument> - Returns:
- this
-
forPropertyIdAndJsonDatatype(PropertyIdValue, String)