Package com.basistech.rosette.dm
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 Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder()Constructs a builder with no data.protectedBuilder(BaseAttribute toCopy) Constructs a builder with values derived from an existing object. -
Method Summary
Modifier and TypeMethodDescriptionprotected static <T> voidaddAllToList(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.protected static <T> voidaddAllToSet(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.Cook up a map to pass to the constructor.extendedProperties(Map<String, Object> properties) Replace the entire extended property map.extendedProperty(String key, Object value) Adds an extended value key-value pair.protected abstract BgetThis()protected static <T> List<T>nullOrList(List<T> newListValue)
-
Constructor Details
-
Builder
protected Builder()Constructs a builder with no data. -
Builder
Constructs a builder with values derived from an existing object.- Parameters:
toCopy- the object to copy
-
-
Method Details
-
getThis
-
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
Adds an extended value key-value pair.- Parameters:
key- the keyvalue- the value- Returns:
- this
-
extendedProperties
Replace the entire extended property map.- Parameters:
properties- a map of extended properties.- Returns:
- this.
-
addAllToList
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
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
-