Class BaseAttribute.Builder<T extends BaseAttribute,B extends BaseAttribute.Builder<T,B>>

java.lang.Object
com.basistech.rosette.dm.BaseAttribute.Builder<T,B>
Direct Known Subclasses:
Attribute.Builder, CategorizerResult.Builder, Concept.Builder, Dependency.Builder, Embeddings.Builder, Entity.Builder, Keyphrase.Builder, LanguageDetection.DetectionResult.Builder, ListAttribute.Builder, MapAttribute.Builder, MorphoAnalysis.Builder, Name.Builder, RelationshipComponent.Builder, SimilarTerm.Builder, TranslatedData.Builder, TranslatedTokens.Builder, Transliteration.Builder, TransliterationResults.Builder
Enclosing class:
BaseAttribute

public abstract static class BaseAttribute.Builder<T extends BaseAttribute,B extends BaseAttribute.Builder<T,B>> extends Object
Base class for builders for the subclasses of BaseAttribute.
  • Constructor Details

    • Builder

      protected Builder()
      Constructs a builder with no data.
    • Builder

      protected Builder(BaseAttribute toCopy)
      Constructs a builder with values derived from an existing object.
      Parameters:
      toCopy - the object to copy
  • Method Details

    • getThis

      protected abstract B getThis()
    • buildExtendedProperties

      protected Map<String,Object> buildExtendedProperties()
      Cook up a map to pass to the constructor. If we have an unmodified map to 'copy', we just use it. Otherwise, we build from the builder.
      Returns:
      the map.
    • extendedProperty

      public B extendedProperty(String key, Object value)
      Adds an extended value key-value pair.
      Parameters:
      key - the key
      value - the value
      Returns:
      this
    • extendedProperties

      public B extendedProperties(Map<String,Object> properties)
      Replace the entire extended property map.
      Parameters:
      properties - a map of extended properties.
      Returns:
      this.
    • addAllToList

      protected static <T> void addAllToList(List<T> list, List<T> toAdd)
      Add all the entries of a list to another list, but don't NPE if the 'to be added' list is null.
      Type Parameters:
      T - type of elements.
      Parameters:
      list - list to add to.
      toAdd - list to add.
    • addAllToSet

      protected static <T> void addAllToSet(Set<T> set, Set<T> toAdd)
      Add all the entries of a set to another set, but don't NPE if the 'to be added' collection is null.
      Type Parameters:
      T - type of elements.
      Parameters:
      set - set to add to.
      toAdd - set to add.
    • nullOrList

      protected static <T> List<T> nullOrList(List<T> newListValue)