private Object mergeReferenceAttributes(String attributeName, EvaluationContext context, ExtendedAttributeDefinition attributeDef, ConfigElement config, Object rawValues) {
        Object rawValue;
        String[] referenceAttributes = getReferenceAttributes(attributeName);
        context.addProcessed(referenceAttributes[0]);
        context.addProcessed(referenceAttributes[1]);
        // get value for the nested element
        rawValue = config.getAttribute(referenceAttributes[1]);
        if (rawValue == null) {
            // if no nested element, then lookup the attribute
            rawValue = config.getAttribute(referenceAttributes[0]);
        } else if (attributeDef.getCardinality() != 0) {
            // we have nested element and attribute allows multiple
            // we must merge if attribute is non null
            Object refRawValue = config.getAttribute(referenceAttributes[0]);
            if (refRawValue != null) {
                rawValue = mergeReferenceValues(attributeDef, refRawValue, rawValue);
            }
        } else {
            // nested value wins if cardinality == 0
        }
        if (rawValues == null) {
            return rawValue;
        }
        if (rawValue == null || attributeDef.getCardinality() == 0) {
            return rawValues;
        }
        return mergeReferenceValues(attributeDef, rawValues, rawValue);
    }
private Object mergeReferenceAttributes ( String attributeName , EvaluationContext context , ExtendedAttributeDefinition attributeDef , ConfigElement config , Object rawValues ) { Object rawValue ; String [ ] referenceAttributes = getReferenceAttributes ( attributeName ) ; context . addProcessed ( referenceAttributes [ 0 ] ) ; context . addProcessed ( referenceAttributes [ 1 ] ) ; rawValue = config . getAttribute ( referenceAttributes [ 1 ] ) ; if ( rawValue == null ) { rawValue = config . getAttribute ( referenceAttributes [ 0 ] ) ; } else if ( attributeDef . getCardinality ( ) != 0 ) { Object refRawValue = config . getAttribute ( referenceAttributes [ 0 ] ) ; if ( refRawValue != null ) { rawValue = mergeReferenceValues ( attributeDef , refRawValue , rawValue ) ; } } else { } if ( rawValues == null ) { return rawValue ; } if ( rawValue == null || attributeDef . getCardinality ( ) == 0 ) { return rawValues ; } return mergeReferenceValues ( attributeDef , rawValues , rawValue ) ; }
Merge references and nested elements prior to evaluation.