當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。