T
- the classV
- the value that the class holds (e.g. String)public abstract class CaseClasses<T,V> extends Object
Modifier and Type | Field and Description |
---|---|
protected Class<T> |
clazz |
protected Collection<T> |
preDefined |
protected Collection<T> |
runtimeDefined |
Constructor and Description |
---|
CaseClasses(Class<T> clazz)
Creates a new case class collection.
|
Modifier and Type | Method and Description |
---|---|
Collection<T> |
all()
Gets all the static constants of the case class.
|
protected abstract T |
create(V value)
Creates a new instance of the case class.
|
T |
find(V value)
Searches for a case object by value, only looking at the case class'
static constants (does not include runtime-defined objects).
|
T |
get(V value)
Searches for a case object by value, creating a new object if one cannot
be found.
|
protected abstract boolean |
matches(T object,
V value)
Determines if a value is associated with a case object.
|
protected volatile Collection<T> preDefined
protected Collection<T> runtimeDefined
public CaseClasses(Class<T> clazz)
clazz
- the case classprotected abstract T create(V value)
value
- the value to give the instanceprotected abstract boolean matches(T object, V value)
object
- the objectvalue
- the valuepublic T find(V value)
value
- the valuepublic T get(V value)
value
- the valuepublic Collection<T> all()
Copyright © 2013-2015 Michael Angstadt. All Rights Reserved.