Update a JavaBean property named <code>identifier</code> with the given <code>value</code>.
@param bean the JavaBean
@param identifier the property name
@param value the new value
18192
protected final void beanUpdate(Object bean, Object identifier, Object value) {
        LOGGER.trace("Update bean \"" + bean + "\" property \"" + identifier + "\"");

        String propertyName = identifier.toString();

        Class beanType = bean.getClass();
        Class propType = PROPERTY_CACHE.getPropertyType(beanType, propertyName);
        // Get the type of the JavaBean property given reflected information from the JavaBean's type
        if(propType != null) {
            try {
                // The type of the JavaBean property is a List.  To update it, get the List and
                // append the value to the end of the List.
                if(List.class.isAssignableFrom(propType)) {
                    Method listGetter = PROPERTY_CACHE.getPropertyGetter(beanType, propertyName);
                    if(listGetter != null) {
                        List list = (List)listGetter.invoke(bean, (Object[])null);
                        applyValuesToList(value, list);
                        return;
                    }
                }
                // The JavaBean is an Object, so set the Bean's property with the given value
                else {
                    Method setter = PROPERTY_CACHE.getPropertySetter(beanType, propertyName);

                    if(setter != null) {
                        LOGGER.trace("Set property via setter method: [" + setter + "]");

                        Class targetType = setter.getParameterTypes()[0];
                        Object converted = ParseUtils.convertType(value, targetType);

                        setter.invoke(bean, new Object[]{converted});
                        return;
                    }
                }
            }
            catch(Exception e) {
                String msg = "Could not update proprety named \"" + propertyName + "\" on bean of type \"" + beanType + "\".  Cause: " + e;
                LOGGER.error(msg, e);
                throw new RuntimeException(msg, e);
            }
        }

        String msg = "Could not update expression because a public JavaBean setter for the property \"" + identifier + "\" could not be found.";
        LOGGER.error(msg);
        throw new RuntimeException(msg);
    }
954465
public void setIdentifierMetadata(IdentifierMetadata identifierMetadata) {
    if (this.identifierMetadata != null) {
      String format = "Class %s has at least two fields, %s and %s, marked with %s annotation. "
          + "Only one field can be marked as an identifier. ";
      String message = String.format(format, entityClass.getName(),
          this.identifierMetadata.getName(), identifierMetadata.getName(),
          Identifier.class.getName());
      throw new EntityManagerException(message);
    }
    this.identifierMetadata = identifierMetadata;
  }
463411
void setValue(T bean, String value) {
    ref.writeValue(converter.fromCharacters(value), bean);
  }
252386
@Override
    public BeanBuilder<T> set(String propertyName, Object value) {
        return set(bean.metaBean().metaProperty(propertyName), value);
    }
297455
protected void setIndexedProperty(Object bean, String name, int[] indexes, Object value, FormMappingOption option) { // e.g. sea[0]
        final BeanDesc beanDesc = BeanDescFactory.getBeanDesc(bean.getClass());
        if (!beanDesc.hasPropertyDesc(name)) {
            return;
        }
        final PropertyDesc pd = beanDesc.getPropertyDesc(name);
        if (!pd.isWritable()) {
            return;
        }
        if (value.getClass().isArray() && Array.getLength(value) > 0) {
            value = Array.get(value, 0);
        }
        final Class<?> propertyType = pd.getPropertyType();
        if (propertyType.isArray()) {
            Object array = pd.getValue(bean);
            final Class<?> elementType = getArrayElementType(propertyType, indexes.length);
            if (array == null) {
                int[] newIndexes = new int[indexes.length];
                newIndexes[0] = indexes[0] + 1;
                array = Array.newInstance(elementType, newIndexes);
            }
            array = expand(array, indexes, elementType);
            pd.setValue(bean, array);
            setArrayValue(array, indexes, value);
        } else { // e.g. List, ImmutableList, MutableList
            // process of your collections should be first because MutableList is java.util.List 
            final Optional<FormYourCollectionResource> yourCollection = findListableYourCollection(pd, option);
            if (yourCollection.isPresent()) { // e.g. ImmutableList, MutableList
                doSetIndexedPropertyListable(bean, name, indexes, value, beanDesc, pd, option, newList -> {
                    @SuppressWarnings("unchecked")
                    final List<Object> filtered = (List<Object>) yourCollection.get().getYourCollectionCreator().apply(newList);
                    return filtered;
                });
            } else if (List.class.isAssignableFrom(propertyType)) {
                doSetIndexedPropertyListable(bean, name, indexes, value, beanDesc, pd, option, Function.identity());
            } else {
                throwIndexedPropertyNotListArrayException(beanDesc, pd);
            }
        }
    }
806164
public static void setProperty(Object bean, String propertyName, Object value,boolean throwExceptionForMissingProperty)
   {
      try
      {
         //find key ignoreClase
         //PropertyUtils.setProperty(aBean, aPropName, aValue);
    	  PropertyDescriptor propertyDescriptor = getPropertyDescriptor(bean,propertyName);
    	  if(propertyDescriptor == null)
    	  {
    		  throw new IllegalArgumentException("propertyName:"+propertyName+" not found for bean:"+bean);
    	  }
    	  Method writeMethod = propertyDescriptor.getWriteMethod();
    	  
    	  if(writeMethod == null)
    	  {
    		  if(throwExceptionForMissingProperty)
    			  throw new IllegalArgumentException("Write method not found for propertyName:"+propertyName+" for bean:"+bean);
    		  else
    			  return; //ignore missing set method for property
    	  }
    	  writeMethod.invoke(bean, value);
    	  
      }
      catch(IllegalArgumentException e)
      {
    	  if(!(value instanceof String))
    		  throw e;
    		  
    	try
  		{
    	  //convert value
    	  PropertyDescriptor desc = getPropertyDescriptor(bean, propertyName);
    	  
    	  String text = (String)value;
    	  
    
			value = Text.toObject(text, desc.getPropertyType().getName());
			  
			  //try again
			  PropertyDescriptor propertyDescriptor = getPropertyDescriptor(bean,propertyName);
	    	  propertyDescriptor.getWriteMethod().invoke(bean, value);
		}
		catch(Exception innerError)
		{
			//failed conversion
			//throw original exception
			throw e;
		}
    	  
      }
      catch(NoSuchMethodException e)
      {
         try
         {
            //find key ignores         
            Object key = Organizer.findByTextIgnoreCase(keySet(bean),propertyName );
           
            PropertyDescriptor propertyDescriptor = getPropertyDescriptor(bean,String.valueOf(key));
      	  propertyDescriptor.getWriteMethod().invoke(bean, value);
         }
         catch (Exception e1)
         {
            String typeName = "null";
            
            if(value != null)
               typeName = value.getClass().getName();
            
            throw new SystemException("type="+typeName+" "+Debugger.toString(e));
         }
      }
      catch(Exception e)
      {
         String typeName = "null";
         
         if(value != null)
            typeName = value.getClass().getName();
         
         throw new SystemException("type="+typeName+" propery:"+propertyName+" ERROR:"+e.getMessage(),e);
      }
   }
984485
@Override
    public void setPropertyValue(PropertyInfo propInfo, Object value) {
        setPropertyValue(propInfo.getId(), value);
    }
529250
public static void setBeanProperty(Object beanObj, String fieldName,
			Object value) throws Exception {
		Class cls = beanObj.getClass();
		Field field = cls.getDeclaredField(fieldName);
		Class fieldCls = field.getType();
		field.setAccessible(true);
		Object fieldObj = str2Obj(fieldCls, value);
		field.set(beanObj, fieldObj);
	}
1338406
public final void setJmsxAppId(String value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setJmsxAppId", value);
        getHdr2().setField(JsHdr2Access.XAPPID_STRINGVALUE, value);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setJmsxAppId");
    }
1255750
@Override
  public <T> T find(Class<T> beanType, Object id) {
    methodCalls.add(MethodCall.of("find").with("beanType", beanType, "id", id));
    WhenBeanReturn match = whenFind.findMatchById(beanType, id);
    if (match != null) {
      return (T)match.val();
    }
    return find.find(beanType, id, null);
  }
954903
@Override
    public void setProperty(String name, Object value) {
        if (currentBeanConfig != null) {
            setPropertyOnBeanConfig(name, value);
        }
    }
702108
public static void resetBean(MethodSpec.Builder methodBuilder, TypeName beanClass, String beanName,
			ModelProperty property, String cursorName, String indexName) {
		SQLTransform transform = lookup(property.getElement().asType());

		if (transform == null) {
			throw new IllegalArgumentException("Transform of " + property.getElement().asType() + " not supported");
		}
		transform.generateResetProperty(methodBuilder, beanClass, beanName, property, cursorName, indexName);

	}
186194
private void addClassInfo(Object value, Class<?> declaredClass) {
        if (value instanceof Bean && !(value instanceof ImmutableBean)) {
            throw new IllegalArgumentException(
                    "Can only serialize immutable beans in referencing binary format: " + value.getClass().getName());
        }

        if (value instanceof ImmutableBean) {
            boolean isConvertible = settings.getConverter().isConvertible(value.getClass());
            boolean noNeedToSerializeTypeName = declaredClass.equals(value.getClass()) &&
                    (classes.containsKey(value.getClass()) || isConvertible);

            if (noNeedToSerializeTypeName) {
                return;
            }

            ImmutableBean bean = (ImmutableBean) value;
            // Don't need metaproperty info if it's a convertible type
            ClassInfo classInfo = isConvertible ?
                    new ClassInfo(value.getClass(), new MetaProperty<?>[0]) :
                    classInfoFromMetaBean(bean.metaBean(), bean.getClass());

            addClassInfoAndIncrementCount(bean.getClass(), classInfo);
            
        } else if (value instanceof Class<?>) {
            Class<?> type = (Class<?>) value;
            if (type.equals(declaredClass) || settings.getConverter().isConvertible(type)) {
                return;
            }
            if (Bean.class.isAssignableFrom(type) && !ImmutableBean.class.isAssignableFrom(type)) {
                throw new IllegalArgumentException(
                        "Can only serialize immutable beans in referencing binary format: " + type.getName());
            }
            if (ImmutableBean.class.isAssignableFrom(type)) {
                if (classes.containsKey(type)) {
                    classSerializationCount.compute(type, BeanReferences::incrementOrOne);
                    return;
                }
                ClassInfo classInfo;
                if (settings.getConverter().isConvertible(type)) {
                    // Don't need metaproperty info if it's a convertible type
                    classInfo = new ClassInfo(type, new MetaProperty<?>[0]);
                } else {
                    SerDeserializer deser = settings.getDeserializers().findDeserializer(type);
                    MetaBean metaBean = deser.findMetaBean(type);
                    classInfo = classInfoFromMetaBean(metaBean, type);
                }
                addClassInfoAndIncrementCount(type, classInfo);
            }
            
        } else if (declaredClass == Object.class && !value.getClass().equals(String.class)) {
            Class<?> effectiveType = settings.getConverter().findTypedConverter(value.getClass()).getEffectiveType();
            ClassInfo classInfo = new ClassInfo(value.getClass(), new MetaProperty<?>[0]);
            addClassInfoAndIncrementCount(effectiveType, classInfo);
            
        } else if (!settings.getConverter().isConvertible(declaredClass)) {
            ClassInfo classInfo = new ClassInfo(value.getClass(), new MetaProperty<?>[0]);
            addClassInfoAndIncrementCount(value.getClass(), classInfo);
        }
    }
1041489
public static void setProperty(Object bean, String expression, Object value) {
		BeanPath.create(expression).set(bean, value);
	}
526179
public void update(Object target) {
        if (target == null) {
            throw new IllegalArgumentException(
                    "Target to update cannot be null");
        }

        BeanWrapper bw = new BeanWrapperImpl(target);
        bw.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true));
        for (Map.Entry<String, Object> property : m_properties.entrySet()) {
            String propertyName = property.getKey();
            Object value = property.getValue();

            if (value instanceof Map) {
                PropertyDescriptor pd = bw.getPropertyDescriptor(propertyName);
                if (!Map.class.isAssignableFrom(pd.getPropertyType()) || pd.getWriteMethod() == null) {
                    value = new DynamicObject((Map<String, Object>) value);
                }
            }

            if (value instanceof DynamicObject) {
                ((DynamicObject) value).update(bw.getPropertyValue(propertyName));
            }
            else {
                bw.setPropertyValue(propertyName, value);
            }
        }
    }
250561
public static <T> void forceUpdateAllProperties(BeanDescriptor<T> beanDescriptor, T model) {
        EntityBeanIntercept intercept = ((EntityBean) model)._ebean_getIntercept();
        intercept.setLoaded();
        int idIndex = beanDescriptor.getIdProperty().getPropertyIndex();
        for (int i = 0; i < intercept.getPropertyLength(); i++) {
            if (i != idIndex) {
                intercept.markPropertyAsChanged(i);
                intercept.setLoadedProperty(i);
            }
        }
    }
111846
public static void set(final Object bean, final String property, Object value) {

        try {
            if (property.indexOf(".") >= 0) {

                final String firstProperty = property.substring(0, property.indexOf("."));
                Object subBean = ClassMockUtils.get(bean, firstProperty);

                if (subBean == null) {

                    subBean = ClassMockUtils.getPropertyClass(bean.getClass(), firstProperty).newInstance();
                    ClassMockUtils.set(bean, firstProperty, subBean);
                }

                final String newProperty = property.substring(property.indexOf(".") + 1);
                ClassMockUtils.set(subBean, newProperty, value);

                return;
            }

            Method setterMethod = null;

            for (final Method method : bean.getClass().getMethods()) {

                if (method.getName().equals(ClassMockUtils.propertyToSetter(property))) {

                    setterMethod = method;
                    break;
                }
            }

            if (setterMethod != null) {

                final Class<?> type = setterMethod.getParameterTypes()[0];

                if (type == null) {

                    throw new RuntimeException("The setter method of " + property + " does not have a parameter.");

                } else if (type.isArray() && !type.getComponentType().isPrimitive()) {

                    final Object[] array = (Object[]) Array.newInstance(type.getComponentType(), ((Object[]) value).length);

                    for (int i = 0; i < array.length; i++) {

                        array[i] = type.getComponentType().cast(((Object[]) value)[i]);
                    }

                    setterMethod.invoke(bean, new Object[] { array });

                } else {

                    if ((value instanceof String) && ((type == Integer.class) || (type == int.class))) {
                        value = Integer.parseInt((String) value);
                    } else if ((value instanceof String) && ((type == Long.class) || (type == long.class))) {
                        value = Long.parseLong((String) value);
                    } else if ((value instanceof String) && ((type == Byte.class) || (type == byte.class))) {
                        value = Byte.parseByte((String) value);
                    } else if ((value instanceof String) && ((type == Short.class) || (type == short.class))) {
                        value = Short.parseShort((String) value);
                    } else if ((value instanceof String) && ((type == Float.class) || (type == float.class))) {
                        value = Float.parseFloat((String) value);
                    } else if ((value instanceof String) && ((type == Double.class) || (type == double.class))) {
                        value = Double.parseDouble((String) value);
                    } else if ((value instanceof String) && ((type == Boolean.class) || (type == boolean.class))) {
                        value = Boolean.parseBoolean((String) value);
                    }

                    setterMethod.invoke(bean, value);
                }
            }
        } catch (final Exception e) {

            throw new RuntimeException("Can't set property " + property + " in the class " + bean.getClass().getName());
        }
    }