Search in sources :

Example 11 with XMLAnyObjectMapping

use of org.eclipse.persistence.oxm.mappings.XMLAnyObjectMapping in project eclipselink by eclipse-ee4j.

the class AnyObjectAndAnyCollectionUC06NoDefaultRootComplexChildrenTestCases method buildRootDescriptor.

protected // 
ClassDescriptor buildRootDescriptor(// 
boolean firstMappingIsAnyCollection, // 
boolean firstMappingXPathSet, // 
boolean secondMappingIsAnyCollection, boolean secondMappingXPathSet) {
    // 
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Customer.class);
    descriptor.setDefaultRootElement("customer");
    DatabaseMapping anyMapping1 = null;
    // First Mapping
    if (!firstMappingIsAnyCollection) {
        anyMapping1 = new XMLAnyObjectMapping();
        anyMapping1.setAttributeName("anyObject");
        // ((XMLAnyObjectMapping) anyMapping1).setSetMethodName("setAnyObject");
        if (firstMappingXPathSet) {
            // set first mapping XPath
            ((XMLAnyObjectMapping) anyMapping1).setXPath(MAPPING_XPATH_OBJ);
        }
        descriptor.addMapping(anyMapping1);
    } else {
        anyMapping1 = new XMLAnyCollectionMapping();
        anyMapping1.setAttributeName("contactMethods");
        // ((XMLAnyCollectionMapping) anyMapping1).setSetMethodName("setAnyCollection");
        if (firstMappingXPathSet) {
            // set first mapping XPath
            ((XMLAnyCollectionMapping) anyMapping1).setXPath(MAPPING_XPATH);
        }
        descriptor.addMapping(anyMapping1);
    }
    // Second Mapping
    DatabaseMapping anyMapping2 = null;
    if (!secondMappingIsAnyCollection) {
        anyMapping2 = new XMLAnyObjectMapping();
        anyMapping2.setAttributeName("anyObject");
        // ((XMLAnyObjectMapping) anyMapping2).setSetMethodName("setAnyObject");
        if (secondMappingXPathSet) {
            // set second mapping XPath
            ((XMLAnyObjectMapping) anyMapping2).setXPath(MAPPING_XPATH_OBJ);
        }
        descriptor.addMapping(anyMapping2);
    } else {
        anyMapping2 = new XMLAnyCollectionMapping();
        anyMapping2.setAttributeName("contactMethods");
        // ((XMLAnyCollectionMapping) anyMapping2).setSetMethodName("setAnyCollection");
        if (secondMappingXPathSet) {
            // set second mapping XPath
            ((XMLAnyCollectionMapping) anyMapping2).setXPath(MAPPING_XPATH);
        }
        descriptor.addMapping(anyMapping2);
    }
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLAnyCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLAnyCollectionMapping) DatabaseMapping(org.eclipse.persistence.mappings.DatabaseMapping) XMLAnyObjectMapping(org.eclipse.persistence.oxm.mappings.XMLAnyObjectMapping)

Example 12 with XMLAnyObjectMapping

use of org.eclipse.persistence.oxm.mappings.XMLAnyObjectMapping in project eclipselink by eclipse-ee4j.

the class AnyObjectNoDefaultRootWithoutGroupingElementProject method buildRootDescriptor.

@Override
public ClassDescriptor buildRootDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Root.class);
    descriptor.setDefaultRootElement("root");
    XMLAnyObjectMapping anyObjectMapping = new XMLAnyObjectMapping();
    anyObjectMapping.setXPath("nested");
    anyObjectMapping.setAttributeName("any");
    anyObjectMapping.setGetMethodName("getAny");
    anyObjectMapping.setSetMethodName("setAny");
    descriptor.addMapping(anyObjectMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLAnyObjectMapping(org.eclipse.persistence.oxm.mappings.XMLAnyObjectMapping)

Example 13 with XMLAnyObjectMapping

use of org.eclipse.persistence.oxm.mappings.XMLAnyObjectMapping in project eclipselink by eclipse-ee4j.

the class AnyObjectAndAnyCollectionUC01NoDefaultRootComplexChildrenTestCases method buildRootDescriptor.

protected // 
ClassDescriptor buildRootDescriptor(// 
boolean firstMappingIsAnyCollection, // 
boolean firstMappingXPathSet, // 
boolean secondMappingIsAnyCollection, boolean secondMappingXPathSet) {
    // 
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Customer.class);
    descriptor.setDefaultRootElement("customer");
    DatabaseMapping anyMapping1 = null;
    // First Mapping
    if (!firstMappingIsAnyCollection) {
        anyMapping1 = new XMLAnyObjectMapping();
        anyMapping1.setAttributeName("anyObject");
        anyMapping1.setGetMethodName("getAnyObject");
        anyMapping1.setSetMethodName("setAnyObject");
        if (firstMappingXPathSet) {
            // set first mapping XPath
            ((XMLAnyObjectMapping) anyMapping1).setXPath(MAPPING_XPATH_OBJ);
        }
        descriptor.addMapping(anyMapping1);
    } else {
        anyMapping1 = new XMLAnyCollectionMapping();
        anyMapping1.setAttributeName("contactMethods");
        anyMapping1.setGetMethodName("getContactMethods");
        anyMapping1.setSetMethodName("setContactMethods");
        if (firstMappingXPathSet) {
            // set first mapping XPath
            ((XMLAnyCollectionMapping) anyMapping1).setXPath(MAPPING_XPATH);
        }
        descriptor.addMapping(anyMapping1);
    }
    // Second Mapping
    DatabaseMapping anyMapping2 = null;
    if (!secondMappingIsAnyCollection) {
        anyMapping2 = new XMLAnyObjectMapping();
        anyMapping2.setAttributeName("anyObject");
        anyMapping2.setGetMethodName("getAnyObject");
        anyMapping2.setSetMethodName("setAnyObject");
        if (secondMappingXPathSet) {
            // set second mapping XPath
            ((XMLAnyObjectMapping) anyMapping2).setXPath(MAPPING_XPATH_OBJ);
        }
        descriptor.addMapping(anyMapping2);
    } else {
        anyMapping2 = new XMLAnyCollectionMapping();
        anyMapping2.setAttributeName("contactMethods");
        anyMapping2.setGetMethodName("getContactMethods");
        anyMapping2.setSetMethodName("setContactMethods");
        if (secondMappingXPathSet) {
            // set second mapping XPath
            ((XMLAnyCollectionMapping) anyMapping2).setXPath(MAPPING_XPATH);
        }
        descriptor.addMapping(anyMapping2);
    }
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLAnyCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLAnyCollectionMapping) DatabaseMapping(org.eclipse.persistence.mappings.DatabaseMapping) XMLAnyObjectMapping(org.eclipse.persistence.oxm.mappings.XMLAnyObjectMapping)

Example 14 with XMLAnyObjectMapping

use of org.eclipse.persistence.oxm.mappings.XMLAnyObjectMapping in project eclipselink by eclipse-ee4j.

the class AnyObjectAndAnyCollectionUC02NoDefaultRootComplexChildrenTestCases method buildRootDescriptor.

protected // 
ClassDescriptor buildRootDescriptor(// 
boolean firstMappingIsAnyCollection, // 
boolean firstMappingXPathSet, // 
boolean secondMappingIsAnyCollection, boolean secondMappingXPathSet) {
    // 
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Customer.class);
    descriptor.setDefaultRootElement("customer");
    DatabaseMapping anyMapping1 = null;
    // First Mapping
    if (!firstMappingIsAnyCollection) {
        anyMapping1 = new XMLAnyObjectMapping();
        anyMapping1.setAttributeName("anyObject");
        // ((XMLAnyObjectMapping) anyMapping1).setSetMethodName("setAnyObject");
        if (firstMappingXPathSet) {
            // set first mapping XPath
            ((XMLAnyObjectMapping) anyMapping1).setXPath(MAPPING_XPATH_OBJ);
        }
        descriptor.addMapping(anyMapping1);
    } else {
        anyMapping1 = new XMLAnyCollectionMapping();
        anyMapping1.setAttributeName("contactMethods");
        // ((XMLAnyCollectionMapping) anyMapping1).setSetMethodName("setAnyCollection");
        if (firstMappingXPathSet) {
            // set first mapping XPath
            ((XMLAnyCollectionMapping) anyMapping1).setXPath(MAPPING_XPATH);
        }
        descriptor.addMapping(anyMapping1);
    }
    // Second Mapping
    DatabaseMapping anyMapping2 = null;
    if (!secondMappingIsAnyCollection) {
        anyMapping2 = new XMLAnyObjectMapping();
        anyMapping2.setAttributeName("anyObject");
        // ((XMLAnyObjectMapping) anyMapping2).setSetMethodName("setAnyObject");
        if (secondMappingXPathSet) {
            // set second mapping XPath
            ((XMLAnyObjectMapping) anyMapping2).setXPath(MAPPING_XPATH_OBJ);
        }
        descriptor.addMapping(anyMapping2);
    } else {
        anyMapping2 = new XMLAnyCollectionMapping();
        anyMapping2.setAttributeName("contactMethods");
        // ((XMLAnyCollectionMapping) anyMapping2).setSetMethodName("setAnyCollection");
        if (secondMappingXPathSet) {
            // set second mapping XPath
            ((XMLAnyCollectionMapping) anyMapping2).setXPath(MAPPING_XPATH);
        }
        descriptor.addMapping(anyMapping2);
    }
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLAnyCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLAnyCollectionMapping) DatabaseMapping(org.eclipse.persistence.mappings.DatabaseMapping) XMLAnyObjectMapping(org.eclipse.persistence.oxm.mappings.XMLAnyObjectMapping)

Example 15 with XMLAnyObjectMapping

use of org.eclipse.persistence.oxm.mappings.XMLAnyObjectMapping in project eclipselink by eclipse-ee4j.

the class AnyObjectAndAnyCollectionUC08NoDefaultRootComplexChildrenTestCases method buildRootDescriptor.

protected // 
ClassDescriptor buildRootDescriptor(// 
boolean firstMappingIsAnyCollection, // 
boolean firstMappingXPathSet, // 
boolean secondMappingIsAnyCollection, boolean secondMappingXPathSet) {
    // 
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Customer.class);
    descriptor.setDefaultRootElement("customer");
    DatabaseMapping anyMapping1 = null;
    // First Mapping
    if (!firstMappingIsAnyCollection) {
        anyMapping1 = new XMLAnyObjectMapping();
        anyMapping1.setAttributeName("anyObject");
        // ((XMLAnyObjectMapping) anyMapping1).setSetMethodName("setAnyObject");
        if (firstMappingXPathSet) {
            // set first mapping XPath
            ((XMLAnyObjectMapping) anyMapping1).setXPath(MAPPING_XPATH_OBJ);
        }
        descriptor.addMapping(anyMapping1);
    } else {
        anyMapping1 = new XMLAnyCollectionMapping();
        anyMapping1.setAttributeName("contactMethods");
        // ((XMLAnyCollectionMapping) anyMapping1).setSetMethodName("setAnyCollection");
        if (firstMappingXPathSet) {
            // set first mapping XPath
            ((XMLAnyCollectionMapping) anyMapping1).setXPath(MAPPING_XPATH);
        }
        descriptor.addMapping(anyMapping1);
    }
    // Second Mapping
    DatabaseMapping anyMapping2 = null;
    if (!secondMappingIsAnyCollection) {
        anyMapping2 = new XMLAnyObjectMapping();
        anyMapping2.setAttributeName("anyObject");
        // ((XMLAnyObjectMapping) anyMapping2).setSetMethodName("setAnyObject");
        if (secondMappingXPathSet) {
            // set second mapping XPath
            ((XMLAnyObjectMapping) anyMapping2).setXPath(MAPPING_XPATH_OBJ);
        }
        descriptor.addMapping(anyMapping2);
    } else {
        anyMapping2 = new XMLAnyCollectionMapping();
        anyMapping2.setAttributeName("contactMethods");
        // ((XMLAnyCollectionMapping) anyMapping2).setSetMethodName("setAnyCollection");
        if (secondMappingXPathSet) {
            // set second mapping XPath
            ((XMLAnyCollectionMapping) anyMapping2).setXPath(MAPPING_XPATH);
        }
        descriptor.addMapping(anyMapping2);
    }
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLAnyCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLAnyCollectionMapping) DatabaseMapping(org.eclipse.persistence.mappings.DatabaseMapping) XMLAnyObjectMapping(org.eclipse.persistence.oxm.mappings.XMLAnyObjectMapping)

Aggregations

XMLAnyObjectMapping (org.eclipse.persistence.oxm.mappings.XMLAnyObjectMapping)28 XMLDescriptor (org.eclipse.persistence.oxm.XMLDescriptor)25 XMLAnyCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLAnyCollectionMapping)18 DatabaseMapping (org.eclipse.persistence.mappings.DatabaseMapping)17 XMLCompositeObjectMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping)4 XMLField (org.eclipse.persistence.oxm.XMLField)3 XMLCompositeCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 AbstractSession (org.eclipse.persistence.internal.sessions.AbstractSession)2 NamespaceResolver (org.eclipse.persistence.oxm.NamespaceResolver)2 XMLBinaryDataMapping (org.eclipse.persistence.oxm.mappings.XMLBinaryDataMapping)2 XMLDirectMapping (org.eclipse.persistence.oxm.mappings.XMLDirectMapping)2 InputStream (java.io.InputStream)1 Set (java.util.Set)1 QName (javax.xml.namespace.QName)1 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)1 DynamicType (org.eclipse.persistence.dynamic.DynamicType)1 InstanceVariableAttributeAccessor (org.eclipse.persistence.internal.descriptors.InstanceVariableAttributeAccessor)1