Package com.gengoai
Class HierarchicalRegistry<T extends HierarchicalEnumValue>
- java.lang.Object
-
- com.gengoai.Registry<T>
-
- com.gengoai.HierarchicalRegistry<T>
-
- Type Parameters:
T
- the type parameter
- All Implemented Interfaces:
Serializable
public final class HierarchicalRegistry<T extends HierarchicalEnumValue> extends Registry<T>
Registry for hierarchical enum values
- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description T
ROOT
The Root.-
Fields inherited from class com.gengoai.Registry
canonicalName, newInstance, registry
-
-
Constructor Summary
Constructors Constructor Description HierarchicalRegistry(SerializableFunction<String,T> newInstance, Class<T> owner)
Instantiates a new Hierarchical registry.HierarchicalRegistry(SerializableFunction<String,T> newInstance, Class<T> owner, String rootName)
Instantiates a new Registry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkName(String name)
protected String
ensureParent(T parent, String name)
Ensures that the non-root parent is prepended onto the enum value nameT
make(String name)
Creates an enum value for the given nameT
make(T parent, String name)
Generates an enum value with the given parent.
-
-
-
Field Detail
-
ROOT
public final T extends HierarchicalEnumValue ROOT
The Root.
-
-
Constructor Detail
-
HierarchicalRegistry
public HierarchicalRegistry(SerializableFunction<String,T> newInstance, Class<T> owner, String rootName)
Instantiates a new Registry.- Parameters:
newInstance
- the new instanceowner
- the ownerrootName
- the root name
-
HierarchicalRegistry
public HierarchicalRegistry(SerializableFunction<String,T> newInstance, Class<T> owner)
Instantiates a new Hierarchical registry.- Parameters:
newInstance
- the new instanceowner
- the owner
-
-
Method Detail
-
checkName
protected void checkName(String name)
-
ensureParent
protected String ensureParent(T parent, String name)
Ensures that the non-root parent is prepended onto the enum value name- Parameters:
parent
- the parentname
- the name- Returns:
- the string
-
make
public T make(T parent, String name)
Generates an enum value with the given parent.- Parameters:
parent
- the parentname
- the name of the enum value- Returns:
- the enum value
-
-