Package Executable
Class ClassList<X,Y>
- java.lang.Object
-
- Executable.ClassList<X,Y>
-
- Type Parameters:
X
- The type of the input to the constructorY
- The super class of the classes to be constructed
public class ClassList<X,Y> extends java.lang.Object
Represents a map of constructors so that a new object of the appropriate child class (given by a string) can be constructed. All constructors must have the same type of single input. Not the best description - probably best to see how it's used!
-
-
Constructor Summary
Constructors Constructor Description ClassList()
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.String type, java.util.function.Function<X,Y> constructor)
Add a new child classY
get(java.lang.String type, X parameters)
Get a new instance of the child classboolean
has(java.lang.String type)
Whether the class list has a class associated with a string
-
-
-
Method Detail
-
add
public void add(java.lang.String type, java.util.function.Function<X,Y> constructor)
Add a new child class- Parameters:
type
- The string representing the child classconstructor
- The constructor for that class
-
get
public Y get(java.lang.String type, X parameters)
Get a new instance of the child class- Parameters:
type
- The string representing the child classparameters
- The input parameter to the constructor- Returns:
- The new child class object
-
has
public boolean has(java.lang.String type)
Whether the class list has a class associated with a string- Parameters:
type
- The string- Returns:
- Whether there is a class associated with it
-
-