T
- the classV
- the value that the class holds (e.g. String)public abstract class CaseClasses<T,V> extends Object
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 (i.e.
|
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 abstract T create(V value)
value
- the value to give the instanceprotected abstract boolean matches(T object, V value)
object
- the case objectvalue
- the valuepublic T find(V value)
value
- the valuepublic T get(V value)
value
- the valuepublic Collection<T> all()
This software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.