根据定义的bean-mapping配置进行对象属性的mapping拷贝 , 允许自定义{@linkplain ValueProcess} {@linkplain SetValueProcess}

@param src
@param target
@throws BeanMappingException
961013
public void mapping(Object src, Object target) throws BeanMappingException {
        boolean first = ContextObjectHolder.getInstance().enter();
        boolean isBeanMappingSupportScript = BeanMappingEnvironment.isBeanMappingSupportScript();
        BeanMappingParam param = new BeanMappingParam();
        param.setSrcRef(src);
        param.setTargetRef(target);
        param.setConfig(this.config);
        List<ValueProcess> vps = BeanMappingEnvironment.getBeanMappingVps();
        param.setProcesses(vps);

        // 执行mapping处理
        try {
            BeanMappingExecutor.execute(param);
        } finally {
            if (first) {// 第一个进入的负责清空数据，可能存在递归调用处理
                ContextObjectHolder.getInstance().clear();
                if (isBeanMappingSupportScript) {
                    ScriptHelper.getInstance().getScriptExecutor().disposeFunctions();// 清空记录
                }
            }
        }
    }
169208
@SuppressWarnings("unchecked")
  <P> void setValues(T bean, List<String> values) {
    Collection<P> col;
    try {
      col = (Collection<P>) listType.newInstance();
    } catch (InstantiationException e) {
      throw new RuntimeException("Can't instantiate " + listType, e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException("Can't access default constructor of " + listType);
    }
    for (String value : values) {
      col.add((P) converter.fromCharacters(value));
    }
    ref.writeValue(col, bean);
  }
924030
public void setProperties(Object bean, Map map) {
        checkInitalised();
        for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) {
            Map.Entry entry = (Map.Entry) iter.next();
            String key = entry.getKey().toString();

            Object value = entry.getValue();
            setProperty(bean, key, value);
        }
    }
457851
public void registerDefaultValueProcessor( Class target, DefaultValueProcessor defaultValueProcessor ) {
      if( target != null && defaultValueProcessor != null ) {
         defaultValueMap.put( target, defaultValueProcessor );
      }
   }
248032
public static void set(Object target, Field field, Object value)
    {
        if (target != null)
        {
            if (!field.isAccessible())
            {
                field.setAccessible(true);
            }
            try
            {
                field.set(target, value);
            }
            catch (IllegalArgumentException iarg)
            {
                throw new PropertyAccessException(iarg);
            }
            catch (IllegalAccessException iacc)
            {
                throw new PropertyAccessException(iacc);
            }
        } // ignore if object is null;
    }
1304799
private static <OriginObject, TargetObject> TargetObject setValue(OriginObject originObject, TargetObject targetObject, Class<TargetObject> targetClass) {

        Field[] targetFields = ReflectUtil.getFieldArrayIncludeSupClassExcludeUID(targetClass);

        Field originField = null; //目标字段类型

        Object originValue = null; //原始对象属性值
        Object targetValue = null; //目标对象属性值

        //从目标对象中找原始对象的属性方式，
        for (Field targetField : targetFields) {

            originField = ReflectUtil.getField(originObject.getClass(), targetField.getName());

            if (originField == null) { //目标对象有，但是原始对象中没有
                continue;
            }

            if (Modifier.isStatic(originField.getModifiers())) {
                continue;
            }

            targetField.setAccessible(true);
            originField.setAccessible(true);

            originValue = ReflectUtil.getFieldVal(originObject, targetField.getName());
            if (originValue == null) { //从原始对象中获取的字段属性为null
                continue;
            }

            targetValue = ValueCast.cast(targetField, targetObject, originValue);

            if (targetValue != null) {
                try {
                    targetField.set(targetObject, targetValue);
                } catch (IllegalArgumentException e) {
                    e.printStackTrace();
                } catch (IllegalAccessException e) {//为目标属性赋值失败
                    e.printStackTrace();
                }
            }
        }

        return targetObject;
    }
623897
public ProcessingInstruction createProcessingInstruction(
          String target, String data) throws DOMException
  {

    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);

    return null;
  }
157360
public void addMappingTarget(String mapping, RequestProcessor target) throws Exception {
        this.requestMapper.addMapping(mapping, target);
    }
1122091
@SuppressWarnings("unchecked")
    <T> void processBean(@Observes ProcessBean<T> processBean) {
        Bean<T> bean = processBean.getBean();
        for (Type type : bean.getTypes()) {
            if (!(type instanceof Class<?>)) {
                continue;
            }

            // Check if the bean is an RedisURI.
            if (RedisURI.class.isAssignableFrom((Class<?>) type)) {
                Set<Annotation> qualifiers = LettuceSets.newHashSet(bean.getQualifiers());
                if (bean.isAlternative() || !redisUris.containsKey(qualifiers)) {
                    LOGGER.debug(String.format("Discovered '%s' with qualifiers %s.", RedisURI.class.getName(), qualifiers));
                    redisUris.put(qualifiers, (Bean<RedisURI>) bean);
                }
            }

            if (ClientResources.class.isAssignableFrom((Class<?>) type)) {
                Set<Annotation> qualifiers = LettuceSets.newHashSet(bean.getQualifiers());
                if (bean.isAlternative() || !clientResources.containsKey(qualifiers)) {
                    LOGGER.debug(String.format("Discovered '%s' with qualifiers %s.", ClientResources.class.getName(),
                            qualifiers));
                    clientResources.put(qualifiers, (Bean<ClientResources>) bean);
                }
            }
        }
    }
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);
    }
398544
public static Map describe(Object src) throws BeanMappingException {
        BeanMap map = BeanMap.create(src.getClass());
        return map.describe(src);
    }
516152
@Override
    public SQLPPMapping createSQLPreProcessedMapping(ImmutableList<SQLPPTriplesMap> ppMappingAxioms,
                                                     MappingMetadata mappingMetadata)
            throws DuplicateMappingException {
        try {
            /**
             * Instantiation
             */
            Constructor constructor = findFirstConstructor(SQLPPMapping.class);
            return (SQLPPMapping) constructor.newInstance(ppMappingAxioms, mappingMetadata);
            /**
             * Exception management
             */
        } catch (InvocationTargetException e) {
            Throwable targetException = e.getTargetException();
            /**
             * Expected exception: rethrown
             */
            if (targetException instanceof DuplicateMappingException) {
                throw (DuplicateMappingException) targetException;
            }
            /**
             * Unexcepted: throw a unexpected RuntimeException.
             */
            throw new RuntimeException(targetException.getMessage());

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
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);
      }
   }
1307260
public static void setPeopertyValue(final Object target, final String fieldName, Object value) {
		JK.logger.trace("setPeopertyValue On class({}) on field ({}) with value ({})", target, fieldName, value);
		try {
			if (value != null) {
				Field field = getFieldByName(target.getClass(), fieldName);
				if (field.getType().isEnum()) {
					Class<? extends Enum> clas = (Class) field.getType();
					value = Enum.valueOf(clas, value.toString());
					JK.logger.debug("Field is enum, new value is ({}) for class ({})", value, value.getClass());
				}
			}
			PropertyUtils.setNestedProperty(target, fieldName, value);

		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
287893
public void copyTo(T valueCopy, StreamRecord<T> target) {
		target.value = valueCopy;
		target.timestamp = this.timestamp;
		target.hasTimestamp = this.hasTimestamp;
	}
79133
public static void mapping(String mappedFieldName, String mappedClassName, String targetFieldName, String targetClassName){
		throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException4,mappedFieldName,mappedClassName, targetFieldName,targetClassName));
	}
288656
public void write(final T source) throws IOException {
        
        Objects.requireNonNull(source, "the bean to write should not be null.");
        
        // update the current row/line numbers
        super.incrementRowAndLineNo();
        
        final CsvContext context = new CsvContext(getLineNumber(), getRowNumber(), 1);
        context.setRowSource(Collections.emptyList());  // 空の値を入れる
        
        final CsvBindingErrors bindingErrors = new CsvBindingErrors(beanMappingCache.getOriginal().getType());
        
        // コールバックメソッドの実行（書き込み前）
        for(CallbackMethod callback : beanMappingCache.getOriginal().getPreWriteMethods()) {
            callback.invoke(source, context, bindingErrors, beanMappingCache.getOriginal());
        }
        
        // extract the bean values
        extractBeanValues(source, beanMappingCache.getNameMapping());
        context.setRowSource(new ArrayList<Object>(beanValues));
        
        Optional<SuperCsvRowException> rowException = Optional.empty();
        try {
            executeCellProcessors(processedColumns, beanValues, beanMappingCache.getCellProcessorsForWriting(), context);
            
        } catch(SuperCsvRowException e) {
            /*
             * カラムごとのCellProcessorのエラーの場合、別なValidatorで値を検証するために、
             * 後から判定を行うようにする。
             */
            rowException = Optional.of(e);
            
            final List<CsvError> errors = exceptionConverter.convert(e, beanMappingCache.getOriginal());
            bindingErrors.addAllErrors(errors);
            
        } catch(SuperCsvException e) {
            // convert exception and format to message.
            errorMessages.addAll(exceptionConverter.convertAndFormat(e, beanMappingCache.getOriginal()));
            throw e;
        }
        
        // レコード、Beanの入力値検証
        if(!beanMappingCache.getOriginal().isSkipValidationOnWrite()) {
            for(CsvValidator<T> validator : validators) {
                validator.validate(source, bindingErrors, new ValidationContext<>(context, beanMappingCache.getOriginal()));
            }
        }
        
        // エラーメッセージの変換
        processErrors(bindingErrors, context, rowException);
        
        // write the list
        super.writeRow(processedColumns);
        
        // コールバックメソッドの実行（書き込み後）
        for(CallbackMethod callback : beanMappingCache.getOriginal().getPostWriteMethods()) {
            callback.invoke(source, context, bindingErrors, beanMappingCache.getOriginal());
        }
        
        // エラーメッセージの変換
        processErrors(bindingErrors, context, rowException);
        
    }