Class GraphicInputFactory<T extends GraphicInput,D extends EntityData>

java.lang.Object
edu.ie3.datamodel.io.factory.Factory<T,D,T>
edu.ie3.datamodel.io.factory.EntityFactory<T,D>
edu.ie3.datamodel.io.factory.input.graphics.GraphicInputFactory<T,D>
Direct Known Subclasses:
LineGraphicInputFactory, NodeGraphicInputFactory

public abstract class GraphicInputFactory<T extends GraphicInput,D extends EntityData> extends EntityFactory<T,D>
Abstract factory implementation for all GraphicInput elements
Since:
08.04.20
  • Constructor Details

    • GraphicInputFactory

      protected GraphicInputFactory(Class<? extends T>... allowedClasses)
  • Method Details

    • getFields

      protected List<Set<String>> getFields(D data)
      Returns list of sets of attribute names that the entity requires to be built.

      The mandatory attributes required to create an GraphicInput are enhanced with custom attribute names that each subclass factory determines in getAdditionalFields().

      Specified by:
      getFields in class Factory<T extends GraphicInput,D extends EntityData,T extends GraphicInput>
      Parameters:
      data - EntityData (or subclass) containing the data
      Returns:
      list of possible attribute sets
    • getAdditionalFields

      protected abstract String[] getAdditionalFields()
      Returns fields other than the required fields of GraphicInput that have to be present.
      Returns:
      Array of field names, can be empty but not null
    • buildModel

      protected T buildModel(D data)
      Description copied from class: Factory
      Builds model with data from given FactoryData object. Throws FactoryException if something goes wrong.
      Specified by:
      buildModel in class Factory<T extends GraphicInput,D extends EntityData,T extends GraphicInput>
      Parameters:
      data - FactoryData (or subclass) containing the data
      Returns:
      model created from data
    • buildModel

      protected abstract T buildModel(D data, UUID uuid, String graphicLayer, org.locationtech.jts.geom.LineString path)
      Creates a graphic input entity with given parameters
      Parameters:
      data - entity data
      uuid - UUID of the input entity
      graphicLayer - Identifier of the graphic layer to place the object on
      path - Line string of the drawing
      Returns:
      newly created asset object