private Object ensureValueCorrectness ( T key , Object value ) { checkKey ( key ) ; if ( key . isCorrectValue ( value ) || value == null ) { return value ; } if ( value instanceof String ) { value = key . parseValue ( String . class . cast ( value ) ) ; return value ; } throw new IllegalArgumentException ( "Entry <'" + key + "','" + value + "'> rejected! Value should be of correct type or of type String(for auto-parsing)!" ) ; }
Ensure that value is of correct type for the given key . If value is not already of correct type but of type String attempt parsing into correct type .