复制Bean对象属性<br>

@param source 源Bean对象
@param target 目标Bean对象
@param ignoreCase 是否忽略大小写
330073
public static void copyProperties(Object source, Object target, boolean ignoreCase) {
		BeanCopier.create(source, target, CopyOptions.create().setIgnoreCase(ignoreCase)).copy();
	}
209515
@SneakyThrows @SuppressWarnings("unchecked")
    private void processExcelRowsAnnotation(Field field, Object bean) {
        val excelRows = field.getAnnotation(ExcelRows.class);
        if (excelRows == null) return;

        if (!Generic.of(field.getGenericType()).isRawType(List.class)) return;

        val templateCell = findTemplateCell(excelRows);
        if (templateCell == null) {
            log.warn("unable to locate template cell for field {}", field);
            return; // 找不到模板单元格，直接忽略字段处理。
        }

        val list = (List<Object>) Fields.invokeField(field, bean);
        val itemSize = PoiUtil.shiftRows(sheet, list, templateCell.getRowIndex());
        if (itemSize > 0) {
            writeRows(templateCell, list);
            mergeRows(excelRows, templateCell, itemSize);
            mergeCols(excelRows, templateCell, itemSize);
        }
    }
109696
public Enumeration<String> getAvailableVariants(String source, String target) {
        CaseInsensitiveString cisrc = new CaseInsensitiveString(source);
        CaseInsensitiveString citrg = new CaseInsensitiveString(target);
        Map<CaseInsensitiveString, List<CaseInsensitiveString>> targets = specDAG.get(cisrc);
        if (targets == null) {
            return new IDEnumeration(null);
        }
        List<CaseInsensitiveString> variants = targets.get(citrg);
        if (variants == null) {
            return new IDEnumeration(null);
        }
        return new IDEnumeration(Collections.enumeration(variants));
    }
232623
protected List<CmsPair<CmsResource, CmsResource>> getMatchingResources(String source, String target)
    throws CmsException {

        List<CmsResource> sourceResources = readTree(source);
        Map<String, CmsResource> sourceRelative = getResourcesByRelativePath(sourceResources, source);

        List<CmsResource> targetResources = readTree(target);
        Map<String, CmsResource> targetRelative = getResourcesByRelativePath(targetResources, target);

        List<CmsPair<CmsResource, CmsResource>> result = new ArrayList<CmsPair<CmsResource, CmsResource>>();
        sourceRelative.keySet().retainAll(targetRelative.keySet());
        for (Map.Entry<String, CmsResource> entry : sourceRelative.entrySet()) {
            String key = entry.getKey();
            CmsResource sourceRes = entry.getValue();
            CmsResource targetRes = targetRelative.get(key);
            result.add(CmsPair.create(sourceRes, targetRes));
        }
        return result;
    }
381588
public static IVarargDependencyInjector bean(final Object target) {
		return new AbstractVarargDependencyInjector() {
			public void with(Object... dependencies) {
				TypeBasedInjector injector = new TypeBasedInjector();
				for (Object dependency : dependencies) {
					injector.validateInjectionOf(target, dependency);
				}
				for (Object dependency : dependencies) {
					injector.inject(target, dependency);
				}
			}
		};
	}
240515
public static int countIgnoreCase(final String source, final String target) {

    if (isEmpty(source) || isEmpty(target)) {
      return 0;
    }
    return count(source.toLowerCase(), target.toLowerCase());
  }
1169303
public static <E, T> List<E> convertBeans(List<T> source, Class<E> targetClass, boolean nonNullFilter) {
        return convertBeans(source, targetClass, null, false, nonNullFilter);
    }
3875
protected void performSingleMoveOperation(String source, String target, String sitePrefix) throws CmsException {

        // calculate the target name
        String finalTarget = getCms().getRequestContext().getFileTranslator().translateResource(target);
        finalTarget = CmsLinkManager.getAbsoluteUri(finalTarget, CmsResource.getParentFolder(source));

        if (finalTarget.equals(source) || (isMultiOperation() && finalTarget.startsWith(source))) {
            throw new CmsVfsException(Messages.get().container(Messages.ERR_MOVE_ONTO_ITSELF_1, finalTarget));
        }

        try {
            CmsResource res = getCms().readResource(finalTarget, CmsResourceFilter.ALL);
            if (res.isFolder()) {
                // target folder already exists, so we add the current folder name
                if (!finalTarget.endsWith("/")) {
                    finalTarget += "/";
                }
                finalTarget = finalTarget + CmsResource.getName(source);
                if (finalTarget.endsWith("/")) {
                    finalTarget = finalTarget.substring(0, finalTarget.length() - 1);
                }
            }
        } catch (CmsVfsResourceNotFoundException e) {
            // target folder does not already exist, so target name is o.k.
            if (LOG.isInfoEnabled()) {
                LOG.info(e.getLocalizedMessage());
            }
        }

        // set the target parameter value
        setParamTarget(finalTarget);

        // could not overwrite a resource in a move operation
        if (getCms().existsResource(finalTarget, CmsResourceFilter.ALL)) {
            // throw exception to indicate that the target exists
            throw new CmsVfsResourceAlreadyExistsException(
                Messages.get().container(
                    Messages.ERR_MOVE_FAILED_TARGET_EXISTS_2,
                    source,
                    getJsp().getRequestContext().removeSiteRoot(finalTarget)));
        }

        // lock resource if autolock is enabled
        checkLock(sitePrefix + source);
        // move the resource
        getCms().moveResource(sitePrefix + source, finalTarget);
    }
215018
public static <E, T, X extends RuntimeException> List<E> parallelConvertIfNullThrow(List<T> source,
            Class<E> targetClass, Supplier<X> exceptionSupplier) {
        return BeansConvertStrategy.parallelConvertBeans(source, targetClass, exceptionSupplier, false);
    }
266003
public BeanMappingObject getBeanMappingObject(Class src, Class target) {
        return getFromRepository(src, target, this.repository);
    }
219302
public static <E, T> List<E> nonNullConvert(List<T> source, Class<E> targetClass) {
        return BeansConvertStrategy.convertBeans(source, targetClass, true);
    }
649700
@SuppressWarnings({"rawtypes", "unchecked"})
    public static Object getClone(Object source) {
        if (null == source) {
            return null;
        }
        Object target = BeanUtils.getOneLayerClone(source);

        try {
            // 此处使用了JAVA的内省机制（内省是 Java 语言对 Bean 类属性、事件的一种缺省处理方法）
            // 获得对像的BeanInfo 信息：
            BeanInfo bi = Introspector.getBeanInfo(source.getClass());
            // 获得属性的描述器
            PropertyDescriptor[] props = bi.getPropertyDescriptors();
            for (int i = 0; i < props.length; ++i) {
                if (null != props[i].getReadMethod()) {
                    Class propertyType = props[i].getPropertyType();
                    if (propertyType.equals(List.class)) {
                        List newList = new ArrayList();
                        // 此处使用了JAVA的反射机制通过获得方法的引用去执行方法，其中source:为要执行的方法所属的对象，
                        // 方法如果没有参数第二个参数则为null;
                        List valueList = (List) props[i].getReadMethod().invoke(source);
                        if (valueList == null) {
                            valueList = new ArrayList();
                        }
                        for (Object value : valueList) {
                            Object cloneValue = null;
                            if (value.getClass().getName().indexOf(ENTITY_CLASS_PACKAGE) >= 0) {
                                cloneValue = BeanUtils.getOneLayerClone(value);
                            } else {
                                cloneValue = value;
                            }
                            newList.add(cloneValue);
                        }
                        props[i].getWriteMethod().invoke(target, newList);
                    }
                    if (propertyType.equals(Set.class)) {
                        Set newSet = new HashSet();
                        Set valueSet = (Set) props[i].getReadMethod().invoke(source);
                        if (valueSet == null) {
                            valueSet = new HashSet();
                        }
                        for (Object value : valueSet) {
                            Object cloneValue = BeanUtils.getOneLayerClone(value);
                            newSet.add(cloneValue);
                        }
                        props[i].getWriteMethod().invoke(target, newSet);
                    } else {
                        // 如果是array 跳过 //FIXME
                        if (propertyType.equals(Arrays.class)) {
                            continue;
                        }
                        if (propertyType.toString().startsWith(ENTITY_CLASS_PACKAGE)) {
                            Object value = props[i].getReadMethod().invoke(source);
                            Object cloneValue = BeanUtils.getOneLayerClone(value);
                            props[i].getWriteMethod().invoke(target, cloneValue);
                        }
                    }
                }
            }
        } catch (Exception e) {
            logger.error("clone object exception object class:" + source.getClass(), e);
        }
        return target;
    }
13100
public static void copy(final JCas sourceView, final JCas targetView)
            throws IllegalArgumentException
    {
        if (hasWebArgumentMetadata(targetView)) {
            throw new IllegalArgumentException(
                    "Target view already contains " + WebArgumentMetadata.class.getName());
        }

        WebArgumentMetadata source = get(sourceView);
        WebArgumentMetadata target = new WebArgumentMetadata(targetView);

        target.setAuthor(source.getAuthor());
        target.setDate(source.getDate());
        target.setDocType(source.getDocType());
        target.setOrigUrl(source.getOrigUrl());
        target.setTopic(source.getTopic());
        target.setThumbsDown(source.getThumbsDown());
        target.setThumbsUp(source.getThumbsUp());
        target.setNotes(source.getNotes());
        target.setOrigId(source.getOrigId());
        target.setTitle(source.getTitle());

        target.addToIndexes();
    }
58659
public void copyValuesFromTo(Collection<Object> source, List<Object> target) {
        target.addAll(source);
    }
730350
@Override
    public void addSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet targetSet) {
        synchronized (UppercaseTransliterator.class) {
            if (sourceTargetUtility == null) {
                sourceTargetUtility = new SourceTargetUtility(new Transform<String,String>() {
                    @Override
                    public String transform(String source) {
                        return UCharacter.foldCase(source, true);
                    }
                });
            }
        }
        sourceTargetUtility.addSourceTargetSet(this, inputFilter, sourceSet, targetSet);
    }
861641
public static String getPattern(Object bean, Object target)
    {
        return stream(bean).filter((s)->{return target.equals(getValue(bean, s));}
229063
public JsonBeanProcessor findJsonBeanProcessor( Class target ) {
      if( !beanProcessorMap.isEmpty() ) {
         Object key = jsonBeanProcessorMatcher.getMatch( target, beanProcessorMap.keySet() );
         return (JsonBeanProcessor) beanProcessorMap.get( key );
      }
      return null;
   }