F
- Type of the first enumeration.S
- Type of the second enumeration.@ThreadSafety(level=NOT_THREAD_SAFE, doc="Please initialize your maps with a static initializer") public final class EnumMapper<F extends Enum<F>,S extends Enum<S>> extends Object
Constructor and Description |
---|
EnumMapper(Class<F> firstEnumClass,
Class<S> secondEnumClass)
Constructs this EnumMapper from the supplied firstEnumClass and
secondEnumClass.
|
Modifier and Type | Method and Description |
---|---|
void |
map(F firstEnumeratedConstant,
S secondEnumeratedConstant)
Maps the supplied firstEnumeratedConstant to the supplied
secondEnumeratedConstant and the other way around.
|
F |
toFirstType(S secondEnumeratedConstant)
Gets the enumerated constant of the first type, that is mapped to the
supplied secondEnumeratedConstant of the second type.
|
S |
toSecondType(F firstEnumeratedConstant)
Gets the enumerated constant of the second type, that is mapped to the
supplied firstEnumeratedConstant of the first type.
|
public EnumMapper(Class<F> firstEnumClass, Class<S> secondEnumClass)
firstEnumClass
- The class type of the first enumeration.secondEnumClass
- The class type of the second enumeration.NullPointerException
- When either the supplied firstEnumClass or
the supplied secondEnumClass is null.public void map(F firstEnumeratedConstant, S secondEnumeratedConstant)
firstEnumeratedConstant
- The first enumerated constant.secondEnumeratedConstant
- The second enumerated constant.NullPointerException
- When either the supplied
firstEnumeratedConstant or the supplied secondEnumeratedConstant is
null.public S toSecondType(F firstEnumeratedConstant)
firstEnumeratedConstant
- The enumerated constant of the first
type.IllegalArgumentException
- When the supplied
firstEnumeratedConstant has not been mapped to an enumerated constant
of the second type.NullPointerException
- when the supplied firstEnumeratedConstant
is null.public F toFirstType(S secondEnumeratedConstant)
secondEnumeratedConstant
- The enumerated constant of the second
type.IllegalArgumentException
- When the supplied
secondEnumeratedConstant has not been mapped to an enumerated constant
of the first type.NullPointerException
- when the supplied secondEnumeratedConstant
is null.Copyright © 2008–2018. All rights reserved.