Class AbstractDataObjectBuilder<T extends AbstractDataObjectBuilder<T,O>,O>

java.lang.Object
org.wikidata.wdtk.datamodel.helpers.AbstractDataObjectBuilder<T,O>
Type Parameters:
T - the type of the eventual concrete builder implementation
O - the type of the object that is being built
Direct Known Subclasses:
EntityDocumentBuilder, ReferenceBuilder, StatementBuilder

public abstract class AbstractDataObjectBuilder<T extends AbstractDataObjectBuilder<T,O>,O> extends Object
Abstract base class for all builder objects that create data model objects.
Author:
Markus Kroetzsch
  • Constructor Details

    • AbstractDataObjectBuilder

      public AbstractDataObjectBuilder()
  • Method Details

    • build

      public abstract O build()
      Returns the object that has been built.
      Returns:
      constructed object
      Throws:
      IllegalStateException - if the object was built already
    • prepareBuild

      protected void prepareBuild()
      Checks if the object has already been built, and throws an exception if yes. If no, then the object is recorded as having been built.
      Throws:
      IllegalStateException - if the object was built already
    • getThis

      protected abstract T getThis()
      Returns the current object with the correct builder type.
      Returns:
      this