当前位置: 首页>>代码示例>>Java>>正文


Java AValueObject类代码示例

本文整理汇总了Java中de.invesdwin.util.bean.AValueObject的典型用法代码示例。如果您正苦于以下问题:Java AValueObject类的具体用法?Java AValueObject怎么用?Java AValueObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AValueObject类属于de.invesdwin.util.bean包,在下文中一共展示了AValueObject类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: copyValue

import de.invesdwin.util.bean.AValueObject; //导入依赖的package包/类
private void copyValue(final IBeanPathElement thisElement, final Object valueThere) {
    boolean copy = true;
    final IPropertyBeanPathElement thisPropertyElement = (IPropertyBeanPathElement) thisElement;
    final Object valueThis = thisPropertyElement.getModifier().getValue();
    if (valueThis != null) {
        if (valueThis instanceof AValueObject) {
            final AValueObject vo = (AValueObject) valueThis;
            if (recursionFilter.add(Objects.toStringIdentity(vo))) {
                new ValueObjectMerge(vo, overwrite, clone, recursionFilter).merge(valueThere);
            }
            copy = clone;
        } else {
            copy = overwrite;
        }
    }

    if (copy) {
        final Class<?> type = thisPropertyElement.getModifier().getAccessor().getRawType().getType();
        final Object convertedValue = convertValue(valueThere, type);
        thisPropertyElement.getModifier().setValue(convertedValue);
    }
}
 
开发者ID:subes,项目名称:invesdwin-util,代码行数:23,代码来源:ValueObjectMerge.java

示例2: ValueObjectMerge

import de.invesdwin.util.bean.AValueObject; //导入依赖的package包/类
public ValueObjectMerge(final AValueObject thisVo, final boolean overwrite, final boolean clone,
        final Set<String> recursionFilter) {
    this.thisVo = thisVo;
    this.overwrite = overwrite;
    this.clone = clone;
    this.recursionFilter = recursionFilter;
}
 
开发者ID:subes,项目名称:invesdwin-util,代码行数:8,代码来源:ValueObjectMerge.java

示例3: merge

import de.invesdwin.util.bean.AValueObject; //导入依赖的package包/类
public void merge(final Object o) {
    //CHECKSTYLE:ON
    final BeanObjectContext thisCtx = new BeanObjectContext(thisVo);
    boolean thisProcessed = false;
    final BeanObjectContext thereCtx = new BeanObjectContext(o);
    new BeanObjectProcessor(thereCtx).withShallowOnly().process();
    for (final IBeanPathElement thereElement : thereCtx.getElementRegistry().getElements()) {
        final String propertyName = thereElement.getAccessor().getBeanPathFragment();
        if (!thereElement.isProperty() || !thereElement.getAccessor().hasPublicGetterOrField()) {
            continue;
        }
        if (Objects.REFLECTION_EXCLUDED_FIELDS.contains(propertyName)) {
            continue;
        }

        final IPropertyBeanPathElement therePropertyElement = (IPropertyBeanPathElement) thereElement;
        Object valueThere = therePropertyElement.getModifier().getValue();
        if (clone && valueThere != null) {
            if (valueThere instanceof AValueObject) {
                final AValueObject cValueThere = (AValueObject) valueThere;
                valueThere = cValueThere.shallowClone();
            } else /* if (valueThere instanceof Cloneable) */ {
                try {
                    valueThere = Reflections.method("clone").in(valueThere).invoke();
                } catch (final Throwable t) {
                    //ignore
                }
            }
        }
        if (valueThere != null) {
            if (!thisProcessed) {
                //process lazy
                new BeanObjectProcessor(thisCtx).withShallowOnly().process();
                thisProcessed = true;
            }
            final IBeanPathElement thisElement = thisCtx.getElementRegistry().getElement(propertyName);
            if (thisElement == null || !thisElement.isProperty()
                    || !thisElement.getAccessor().hasPublicSetterOrField()) {
                continue;
            }

            copyValue(thisElement, valueThere);
        }
    }
}
 
开发者ID:subes,项目名称:invesdwin-util,代码行数:46,代码来源:ValueObjectMerge.java


注:本文中的de.invesdwin.util.bean.AValueObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。