public static <V> void validateConfiguredValueType(Class<V> valueType, V value) throws ClassCastException {
        if (Object.class != valueType) {
            // means that type checks is required
            if (!valueType.isAssignableFrom(value.getClass())) {
                throw new ClassCastException("Value '" + value + "' is not assignable to " + valueType);
            }
        }
    }
public static < V > void validateConfiguredValueType ( Class < V > valueType , V value ) throws ClassCastException { if ( Object . class != valueType ) { if ( ! valueType . isAssignableFrom ( value . getClass ( ) ) ) { throw new ClassCastException ( "Value '" + value + "' is not assignable to " + valueType ) ; } } }
Validates the value with value type.

@param valueType value class.
@param value     value to be validated.
@param <V>       the type of value.
@throws ClassCastException if the provided value do not match with valueType.