use of org.eclipse.persistence.oxm.mappings.XMLAnyAttributeMapping in project eclipselink by eclipse-ee4j.
the class MappingsGenerator method generateAnyAttributeMapping.
public AnyAttributeMapping generateAnyAttributeMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) {
XMLAnyAttributeMapping mapping = new XMLAnyAttributeMapping();
initializeXMLMapping(mapping, property);
initializeXMLContainerMapping(mapping, property.getType().isArray());
// if the XPath is set (via xml-path) use it
if (property.getXmlPath() != null) {
mapping.setField(new XMLField(property.getXmlPath()));
}
mapping.setSchemaInstanceIncluded(false);
mapping.setNamespaceDeclarationIncluded(false);
JavaClass mapType = property.getType();
if (areEquals(mapType, Map.class)) {
mapType = jotHashMap;
}
mapping.useMapClassName(mapType.getRawName());
return mapping;
}
use of org.eclipse.persistence.oxm.mappings.XMLAnyAttributeMapping in project eclipselink by eclipse-ee4j.
the class SDOObjectType method addOpenMappings.
protected void addOpenMappings() {
XMLAnyCollectionMapping anyMapping = new XMLAnyCollectionMapping();
anyMapping.setAttributeName(ANY_MAPPING_ATTRIBUTE_NAME);
anyMapping.setGetMethodName(ANY_MAPPING_GET_METHOD_NAME);
anyMapping.setSetMethodName(ANY_MAPPING_SET_METHOD_NAME);
anyMapping.setUseXMLRoot(true);
getXmlDescriptor().addMapping(anyMapping);
XMLAnyAttributeMapping anyAttrMapping = new XMLAnyAttributeMapping();
anyAttrMapping.setAttributeName("openContentPropertiesAttributes");
anyAttrMapping.setGetMethodName("_getOpenContentPropertiesAttributesMap");
anyAttrMapping.setSetMethodName("_setOpenContentPropertiesAttributesMap");
getXmlDescriptor().addMapping(anyAttrMapping);
}
use of org.eclipse.persistence.oxm.mappings.XMLAnyAttributeMapping in project eclipselink by eclipse-ee4j.
the class AnyAttributeReuseProject method buildRootDescriptor.
public ClassDescriptor buildRootDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Root.class);
descriptor.setDefaultRootElement("root");
XMLAnyAttributeMapping mapping = new XMLAnyAttributeMapping();
mapping.setAttributeName("any");
mapping.setGetMethodName("getAny");
mapping.setSetMethodName("setAny");
mapping.setReuseContainer(true);
descriptor.addMapping(mapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLAnyAttributeMapping in project eclipselink by eclipse-ee4j.
the class TestProject method getPhoneNumberDescriptor.
private XMLDescriptor getPhoneNumberDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(PhoneNumber.class);
descriptor.setAlias("PhoneNumber");
descriptor.setNamespaceResolver(nsr);
if (setSchemaContext) {
XMLSchemaReference sRef = new XMLSchemaURLReference();
sRef.setSchemaContext("/phone-number-type");
sRef.setType(XMLSchemaReference.COMPLEX_TYPE);
descriptor.setSchemaReference(sRef);
}
if (setDefaultRootElement) {
descriptor.setDefaultRootElement("phone-number");
}
// create number mapping
XMLDirectMapping numberMapping = new XMLDirectMapping();
numberMapping.setAttributeName("number");
numberMapping.setXPath("number/text()");
descriptor.addMapping(numberMapping);
// create thing mapping
XMLAnyAttributeMapping anyMapping = new XMLAnyAttributeMapping();
anyMapping.setAttributeName("thing");
descriptor.addMapping(anyMapping);
/*
// create type mapping
XMLDirectMapping typeMapping = new XMLDirectMapping();
typeMapping.setAttributeName("type");
typeMapping.setXPath("@type");
EnumTypeConverter converter = new EnumTypeConverter(typeMapping, PhoneNumberType.class, false);
typeMapping.setConverter(converter);
descriptor.addMapping(typeMapping);
*/
return descriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLAnyAttributeMapping in project eclipselink by eclipse-ee4j.
the class AnyAttributeUsingMapProject method buildRootDescriptor.
public ClassDescriptor buildRootDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Root.class);
descriptor.setDefaultRootElement("root");
XMLAnyAttributeMapping mapping = new XMLAnyAttributeMapping();
mapping.setAttributeName("any");
mapping.setGetMethodName("getAny");
mapping.setSetMethodName("setAny");
mapping.useMapClass(java.util.Hashtable.class);
descriptor.addMapping(mapping);
return descriptor;
}
Aggregations