public final class GenericsUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
getTypeSafeValue(String entity,
Object entityKey,
Object value,
Class<T> expectedValueType)
Returns the given value cast to the the given type.
|
static <S> S |
getTypeSafeValue(String entity,
Object entityKey,
Object value,
com.google.common.reflect.TypeToken<S> expectedValueType)
Returns the given value cast to the the given type.
|
public static <T> T getTypeSafeValue(String entity, Object entityKey, Object value, Class<T> expectedValueType)
IllegalArgumentException
is thrown in case the type case is not possible.T
- the type of the expected valueentity
- the name of the type of entity to which the value belongsentityKey
- the entity key to which the value belongsvalue
- the value to convertexpectedValueType
- the expected type of the valueIllegalArgumentException
- thrown if the cast is not possiblepublic static <S> S getTypeSafeValue(String entity, Object entityKey, Object value, com.google.common.reflect.TypeToken<S> expectedValueType)
IllegalArgumentException
is thrown in case the type case is not possible.S
- the type of the expected valueentity
- the name of the type of entity to which the value belongsentityKey
- the entity key to which the value belongsvalue
- the value to convertexpectedValueType
- the expected type of the valueIllegalArgumentException
- thrown if the cast is not possibleCopyright © 2010 - 2018 edorasware ag. All Rights Reserved.