/** * Get the value of a field on an object as a specific type, * name can be nested, indexed, or mapped * @param obj any object * @param name the name of a field on this object * @param asType the type to return the value as (converts as needed) * @return the value in the field as the type requested * @throws FieldnameNotFoundException if this field name is invalid for this object * @throws FieldGetValueException if the field is not readable or not visible * @throws UnsupportedOperationException if the value cannot be converted to the type requested * @throws IllegalArgumentException if there is a failure getting the value */ public <T> T getFieldValue(Object obj, String name, Class<T> asType) { Object o = getFieldValue(obj, name); T value = getConversionUtils().convert(o, asType); return value; }
/** * Get the value of a field on an object as a specific type, * name can be nested, indexed, or mapped * @param obj any object * @param name the name of a field on this object * @param asType the type to return the value as (converts as needed) * @return the value in the field as the type requested * @throws FieldnameNotFoundException if this field name is invalid for this object * @throws FieldGetValueException if the field is not readable or not visible * @throws UnsupportedOperationException if the value cannot be converted to the type requested * @throws IllegalArgumentException if there is a failure getting the value */ public <T> T getFieldValue(Object obj, String name, Class<T> asType) { Object o = getFieldValue(obj, name); T value = getConversionUtils().convert(o, asType); return value; }
value = getConversionUtils().convert(value, field.getType()); field.set(obj, value); } catch (Exception e) {
value = getConversionUtils().convert(value, field.getType()); field.set(obj, value); } catch (Exception e) {
value = getConversionUtils().convert(value, type);
value = getConversionUtils().convert(value, type);