use of org.eclipse.persistence.oxm.XMLDescriptor in project eclipselink by eclipse-ee4j.
the class TestModelProject method addCollectionReferenceTargetDescriptor.
public void addCollectionReferenceTargetDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClassName("org.persistence.testing.jaxb.dynamic.xxx.CollectionReferenceTarget");
descriptor.addPrimaryKeyFieldName("@id");
descriptor.setNamespaceResolver(nsResolver);
XMLDirectMapping id = new XMLDirectMapping();
id.setAttributeName("id");
id.setXPath("@id");
descriptor.addMapping(id);
XMLDirectMapping value = new XMLDirectMapping();
value.setAttributeName("value");
value.setXPath("value/text()");
descriptor.addMapping(value);
this.addDescriptor(descriptor);
}
use of org.eclipse.persistence.oxm.XMLDescriptor in project eclipselink by eclipse-ee4j.
the class TestModelProject method addCompositeCollectionTargetDescriptor.
public void addCompositeCollectionTargetDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClassName("org.persistence.testing.jaxb.dynamic.xxx.CompositeCollectionTarget");
descriptor.setNamespaceResolver(nsResolver);
XMLDirectMapping value = new XMLDirectMapping();
value.setAttributeName("value");
value.setXPath("value/text()");
descriptor.addMapping(value);
XMLInverseReferenceMapping invRef = new XMLInverseReferenceMapping();
invRef.setReferenceClassName("org.persistence.testing.jaxb.dynamic.xxx.Root");
invRef.setMappedBy("compColl");
invRef.setAttributeName("invRef");
descriptor.addMapping(invRef);
this.addDescriptor(descriptor);
}
use of org.eclipse.persistence.oxm.XMLDescriptor in project eclipselink by eclipse-ee4j.
the class TestModelProject method addAnyCollectionTargetDescriptor.
public void addAnyCollectionTargetDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClassName("org.persistence.testing.jaxb.dynamic.xxx.AnyCollectionTarget");
descriptor.setDefaultRootElement("any-coll-value");
descriptor.setNamespaceResolver(nsResolver);
XMLDirectMapping value = new XMLDirectMapping();
value.setAttributeName("value");
value.setXPath("text()");
descriptor.addMapping(value);
this.addDescriptor(descriptor);
}
use of org.eclipse.persistence.oxm.XMLDescriptor in project eclipselink by eclipse-ee4j.
the class XmlAnyElementListTestCases method testContainerType.
public void testContainerType() {
XMLDescriptor xDesc = xmlContext.getDescriptor(new QName("employee"));
assertNotNull("No descriptor was generated for EmployeeWithList.", xDesc);
DatabaseMapping mapping = xDesc.getMappingForAttributeName("stuff");
assertNotNull("No mapping exists on EmployeeWithList for attribute [stuff].", mapping);
assertTrue("Expected an XMLAnyCollectionMapping for attribute [stuff], but was [" + mapping.toString() + "].", mapping instanceof XMLAnyCollectionMapping);
assertTrue("Expected container class [java.util.LinkedList] but was [" + mapping.getContainerPolicy().getContainerClassName() + "]", mapping.getContainerPolicy().getContainerClassName().equals("java.util.LinkedList"));
}
use of org.eclipse.persistence.oxm.XMLDescriptor in project eclipselink by eclipse-ee4j.
the class XmlValueCdnPricesTestCases method testContainerType.
public void testContainerType() {
XMLDescriptor xDesc = xmlContext.getDescriptor(new QName("canadian-price"));
assertNotNull("No descriptor was generated for CDNPricesNoAnnotation.", xDesc);
DatabaseMapping mapping = xDesc.getMappingForAttributeName("prices");
assertNotNull("No mapping exists on CDNPricesNoAnnotation for attribute [prices].", mapping);
assertTrue("Expected an XMLCompositeDirectCollectionMapping for attribute [prices], but was [" + mapping.toString() + "].", mapping instanceof XMLCompositeDirectCollectionMapping);
assertTrue("Expected container class [java.util.LinkedList] but was [" + mapping.getContainerPolicy().getContainerClassName() + "]", mapping.getContainerPolicy().getContainerClassName().equals("java.util.LinkedList"));
}
Aggregations