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
ConstructorsModifierConstructorDescriptionprotectedPropertyDocumentBuilder(PropertyDocument initialDocument) Constructor when building the property document from an existing one.protectedPropertyDocumentBuilder(PropertyIdValue propertyIdValue, DatatypeIdValue datatype) Constructor when building the property document from scratch. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns theItemDocumentthat has been built.static PropertyDocumentBuilderforPropertyIdAndDatatype(PropertyIdValue propertyIdValue, String datatypeId) Deprecated.static PropertyDocumentBuilderforPropertyIdAndDatatype(PropertyIdValue propertyIdValue, DatatypeIdValue datatype) Starts the construction of anPropertyDocumentwith the given id.static PropertyDocumentBuilderforPropertyIdAndJsonDatatype(PropertyIdValue propertyIdValue, String datatypeId) Starts the construction of anPropertyDocumentwith the given id.static PropertyDocumentBuilderfromPropertyDocument(PropertyDocument initialDocument) Starts the construction of anPropertyDocumentfrom the existing document.protected PropertyDocumentBuildergetThis()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, withStatementMethods 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 anPropertyDocumentwith 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 anPropertyDocumentfrom 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 anPropertyDocumentwith 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 anPropertyDocumentwith 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:
withEntityIdin classEntityDocumentBuilder<PropertyDocumentBuilder,PropertyDocument> - Parameters:
entityId- the entity id, which must be an ItemIdValue- Returns:
- builder object to continue construction
-
build
Returns theItemDocumentthat has been built.- Specified by:
buildin classAbstractDataObjectBuilder<PropertyDocumentBuilder,PropertyDocument> - Returns:
- constructed item document
- Throws:
IllegalStateException- if the object was built already
-
getThis
Description copied from class:AbstractDataObjectBuilderReturns the current object with the correct builder type.- Specified by:
getThisin classAbstractDataObjectBuilder<PropertyDocumentBuilder,PropertyDocument> - Returns:
- this
-
forPropertyIdAndJsonDatatype(PropertyIdValue, String)