public class GenericsUtils extends Object
Provides utility methods related to Generics.
| Modifier and Type | Method and Description | 
|---|---|
static <T> T | 
getTypeSafeValue(String entityType,
                Object entityKey,
                Object value,
                Class<T> expectedValueType)
Returns the given value cast to the the given type. 
 | 
static <S> S | 
getTypeSafeValue(String entityType,
                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 entityType, Object entityKey, Object value, Class<T> expectedValueType)
Returns the given value cast to the the given type. An IllegalArgumentException is thrown in case the type case is not possible.
T - the type of the expected valueentityType - the entity typeentityKey - 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 entityType, Object entityKey, Object value, com.google.common.reflect.TypeToken<S> expectedValueType)
Returns the given value cast to the the given type. An IllegalArgumentException is thrown in case the type case is not possible.
S - the type of the expected valueentityType - the entity typeentityKey - 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.