/** * Set the value of a field on an object (automatically auto converts), * name can be nested, indexed, or mapped * * @param obj any object * @param name the name of a field on this object * @param value the value to set the field to (must match target exactly) * @throws FieldnameNotFoundException if this field name is invalid for this object * @throws FieldSetValueException if the field is not writeable or visible * @throws IllegalArgumentException if there is a general failure setting the value */ public void setFieldValue(Object obj, String name, Object value) { setFieldValue(obj, name, value, true); }
/** * Set the value of a field on an object (automatically auto converts), * name can be nested, indexed, or mapped * * @param obj any object * @param name the name of a field on this object * @param value the value to set the field to (must match target exactly) * @throws FieldnameNotFoundException if this field name is invalid for this object * @throws FieldSetValueException if the field is not writeable or visible * @throws IllegalArgumentException if there is a general failure setting the value */ public void setFieldValue(Object obj, String name, Object value) { setFieldValue(obj, name, value, true); }
/** * Set the value on the object field or setter method, will convert if needed<br/> * Setting fields supports simple, nested, indexed, and mapped values:<br/> * <b>Simple:</b> Get/set a field in a bean (or map), Example: "title", "id"<br/> * <b>Nested:</b> Get/set a field in a bean which is contained in another bean, Example: "someBean.title", "someBean.id"<br/> * <b>Indexed:</b> Get/set a list/array item by index in a bean, Example: "myList[1]", "anArray[2]"<br/> * <b>Mapped:</b> Get/set a map entry by key in a bean, Example: "myMap(key)", "someMap(thing)"<br/> * * @param object any object * @param fieldName the name of the field (property) to set the value of or the setter method without the "set" and lowercase first char * @param value the value to set on this field, must match the type in the object (will not attempt to covert) * @throws FieldnameNotFoundException if the fieldName could not be found in this object * @throws UnsupportedOperationException if the value could not be converted to the field type * @throws IllegalArgumentException if the params are null or other failures occur setting the value */ public void setFieldValue(Object object, String fieldName, Object value) { getFieldUtils().setFieldValue(object, fieldName, value); }
/** * Set the value on the object field or setter method, will convert if needed<br/> * Setting fields supports simple, nested, indexed, and mapped values:<br/> * <b>Simple:</b> Get/set a field in a bean (or map), Example: "title", "id"<br/> * <b>Nested:</b> Get/set a field in a bean which is contained in another bean, Example: "someBean.title", "someBean.id"<br/> * <b>Indexed:</b> Get/set a list/array item by index in a bean, Example: "myList[1]", "anArray[2]"<br/> * <b>Mapped:</b> Get/set a map entry by key in a bean, Example: "myMap(key)", "someMap(thing)"<br/> * * @param object any object * @param fieldName the name of the field (property) to set the value of or the setter method without the "set" and lowercase first char * @param value the value to set on this field, must match the type in the object (will not attempt to covert) * @throws FieldnameNotFoundException if the fieldName could not be found in this object * @throws UnsupportedOperationException if the value could not be converted to the field type * @throws IllegalArgumentException if the params are null or other failures occur setting the value */ public void setFieldValue(Object object, String fieldName, Object value) { getFieldUtils().setFieldValue(object, fieldName, value); }
/** * Sets a value on the field of an object and will attempt to convert the property if configured to do so<br/> * Setting fields supports simple, nested, indexed, and mapped values:<br/> * <b>Simple:</b> Get/set a field in a bean (or map), Example: "title", "id"<br/> * <b>Nested:</b> Get/set a field in a bean which is contained in another bean, Example: "someBean.title", "someBean.id"<br/> * <b>Indexed:</b> Get/set a list/array item by index in a bean, Example: "myList[1]", "anArray[2]"<br/> * <b>Mapped:</b> Get/set a map entry by key in a bean, Example: "myMap(key)", "someMap(thing)"<br/> * * @param object any object * @param fieldName the name of the field (property) to set the value of or the setter method without the "set" and lowercase first char * @param value the value to set on this field, does not have to match the type in the object, * the type will be determined and then we will attempt to convert this value to the type in the field * @param autoConvert if true then automatically try to convert the value to the type of the field being set, * otherwise only set the field if the value matches the type * @throws FieldnameNotFoundException if the fieldName could not be found in this object * @throws IllegalArgumentException if the value type does not match the field type or the type could not be converted to the field type * @throws UnsupportedOperationException if the value could not be converted to the field type */ public void setFieldValue(Object object, String fieldName, Object value, boolean autoConvert) { getFieldUtils().setFieldValue(object, fieldName, value, autoConvert); }
/** * Sets a value on the field of an object and will attempt to convert the property if configured to do so<br/> * Setting fields supports simple, nested, indexed, and mapped values:<br/> * <b>Simple:</b> Get/set a field in a bean (or map), Example: "title", "id"<br/> * <b>Nested:</b> Get/set a field in a bean which is contained in another bean, Example: "someBean.title", "someBean.id"<br/> * <b>Indexed:</b> Get/set a list/array item by index in a bean, Example: "myList[1]", "anArray[2]"<br/> * <b>Mapped:</b> Get/set a map entry by key in a bean, Example: "myMap(key)", "someMap(thing)"<br/> * * @param object any object * @param fieldName the name of the field (property) to set the value of or the setter method without the "set" and lowercase first char * @param value the value to set on this field, does not have to match the type in the object, * the type will be determined and then we will attempt to convert this value to the type in the field * @param autoConvert if true then automatically try to convert the value to the type of the field being set, * otherwise only set the field if the value matches the type * @throws FieldnameNotFoundException if the fieldName could not be found in this object * @throws IllegalArgumentException if the value type does not match the field type or the type could not be converted to the field type * @throws UnsupportedOperationException if the value could not be converted to the field type */ public void setFieldValue(Object object, String fieldName, Object value, boolean autoConvert) { getFieldUtils().setFieldValue(object, fieldName, value, autoConvert); }
toSet = value[0]; getFieldUtils().setFieldValue(object, fieldName, toSet, true);
toSet = value[0]; getFieldUtils().setFieldValue(object, fieldName, toSet, true);
/** * Replace the container with a new one based on the parent and settings in this Container */ public void replaceContainer(Object container) { if (container == null) { throw new IllegalArgumentException("No null params allowed"); } if (key != null) { FieldUtils.getInstance().setFieldValue(parent, key, container); } else if (index >= 0) { FieldUtils.getInstance().setIndexedValue(parent, index, container); } // if not key or index then do nothing except replacing the value this.container = container; } /**
/** * Replace the container with a new one based on the parent and settings in this Container */ public void replaceContainer(Object container) { if (container == null) { throw new IllegalArgumentException("No null params allowed"); } if (key != null) { FieldUtils.getInstance().setFieldValue(parent, key, container); } else if (index >= 0) { FieldUtils.getInstance().setIndexedValue(parent, index, container); } // if not key or index then do nothing except replacing the value this.container = container; } /**
if ( ConstructorUtils.isClassSimple(targetType) ) { getFieldUtils().setFieldValue(object, fieldName, value, true); } else { dest = getConstructorUtils().constructClass(targetType); getFieldUtils().setFieldValue(object, fieldName, dest, true);
if ( ConstructorUtils.isClassSimple(targetType) ) { getFieldUtils().setFieldValue(object, fieldName, value, true); } else { dest = getConstructorUtils().constructClass(targetType); getFieldUtils().setFieldValue(object, fieldName, dest, true);
getFieldUtils().setFieldValue(dest, name, internalDeepClone(value, CopyDestination.ORIGINAL, maxDepth, null, currentDepth, ignoreNulls, false)); getFieldUtils().setFieldValue(dest, name, internalDeepClone(value, CopyDestination.ORIGINAL, maxDepth, null, currentDepth, ignoreNulls, false));
getFieldUtils().setFieldValue(dest, name, internalDeepClone(value, CopyDestination.ORIGINAL, maxDepth, null, currentDepth, ignoreNulls, false)); getFieldUtils().setFieldValue(dest, name, internalDeepClone(value, CopyDestination.ORIGINAL, maxDepth, null, currentDepth, ignoreNulls, false));
setFieldValue(obj, next, nestedBean, false); // need to put this new object into the parent } catch (RuntimeException e) { throw new IllegalArgumentException("Nested path failure: Could not create nested object ("
setFieldValue(obj, next, nestedBean, false); // need to put this new object into the parent } catch (RuntimeException e) { throw new IllegalArgumentException("Nested path failure: Could not create nested object ("
internalDeepClone(value, dest, maxDepth, null, currentDepth, ignoreNulls, ignoreTransient) ); } else { getFieldUtils().setFieldValue(copy, name, internalDeepClone(value, dest, maxDepth, null, currentDepth, ignoreNulls, ignoreTransient) ); internalDeepClone(value, dest, maxDepth, null, currentDepth, ignoreNulls, ignoreTransient) ); } else { getFieldUtils().setFieldValue(copy, name, internalDeepClone(value, dest, maxDepth, null, currentDepth, ignoreNulls, ignoreTransient) );
internalDeepClone(value, dest, maxDepth, null, currentDepth, ignoreNulls, ignoreTransient) ); } else { getFieldUtils().setFieldValue(copy, name, internalDeepClone(value, dest, maxDepth, null, currentDepth, ignoreNulls, ignoreTransient) ); internalDeepClone(value, dest, maxDepth, null, currentDepth, ignoreNulls, ignoreTransient) ); } else { getFieldUtils().setFieldValue(copy, name, internalDeepClone(value, dest, maxDepth, null, currentDepth, ignoreNulls, ignoreTransient) );