public void addEmployeeDescriptor(boolean methodAccess) { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(Employee.class); descriptor.setDefaultRootElement("employee"); XMLDirectMapping idMapping = new XMLDirectMapping(); idMapping.setAttributeName("id"); idMapping.setXPath("@id"); descriptor.addMapping(idMapping); XMLDirectMapping firstNameMapping = new XMLDirectMapping(); firstNameMapping.setAttributeName("firstName"); firstNameMapping.setXPath("first-name/text()"); descriptor.addMapping(firstNameMapping); XMLDirectMapping lastNameMapping = new XMLDirectMapping(); lastNameMapping.setAttributeName("lastName"); lastNameMapping.setXPath("last-name/text()"); descriptor.addMapping(lastNameMapping); XMLCompositeObjectMapping addressMapping = new XMLCompositeObjectMapping(); addressMapping.setAttributeName("address"); addressMapping.setReferenceClass(Address.class); addressMapping.setXPath("address"); descriptor.addMapping(addressMapping); XMLCompositeCollectionMapping phoneMapping = new XMLCompositeCollectionMapping(); phoneMapping.setAttributeName("phoneNumbers"); phoneMapping.setReferenceClass(PhoneNumber.class); phoneMapping.setXPath("phone-numbers/number"); phoneMapping.setContainerPolicy(ContainerPolicy.buildPolicyFor(ArrayList.class)); descriptor.addMapping(phoneMapping); this.addDescriptor(descriptor); }
public void addPhoneNumberDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(PhoneNumber.class); XMLDirectMapping numberMapping = new XMLDirectMapping(); numberMapping.setAttributeName("number"); numberMapping.setXPath("text()"); descriptor.addMapping(numberMapping); this.addDescriptor(descriptor); }
public void addPhoneNumberDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(PhoneNumber.class); descriptor.setDefaultRootElement("phone-number"); XMLDirectMapping num = new XMLDirectMapping(); num.setAttributeName("number"); num.setXPath("text()"); descriptor.addMapping(num); this.addDescriptor(descriptor); }
public XMLDescriptor addAddressDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(Address.class); descriptor.setDefaultRootElement("address"); XMLDirectMapping street = new XMLDirectMapping(); street.setAttributeName("street"); street.setXPath("street/text()"); descriptor.addMapping(street); this.addDescriptor(descriptor); return descriptor; }
public ClassDescriptor buildChildDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(AnyCollectionChild.class); descriptor.setDefaultRootElement("child"); descriptor.addRootElement("someChild"); XMLDirectMapping mapping = new XMLDirectMapping(); mapping.setAttributeName("content"); mapping.setGetMethodName("getContent"); mapping.setSetMethodName("setContent"); mapping.setXPath("text()"); descriptor.addMapping(mapping); return descriptor; }
public void addPhoneNumberDescriptor(boolean methodAccess) { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(PhoneNumber.class); XMLDirectMapping numberMapping = new XMLDirectMapping(); numberMapping.setAttributeName("number"); numberMapping.setXPath("text()"); descriptor.addMapping(numberMapping); XMLInverseReferenceMapping owningEmployee = new XMLInverseReferenceMapping(); owningEmployee.setReferenceClass(Employee.class); owningEmployee.setMappedBy("phoneNumbers"); owningEmployee.setAttributeName("owningEmployee"); if (methodAccess) { owningEmployee.setSetMethodName("setOwningEmployee"); owningEmployee.setGetMethodName("getOwningEmployee"); } descriptor.addMapping(owningEmployee); this.addDescriptor(descriptor); }
public void addAddressDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(Address.class); XMLDirectMapping streetMapping = new XMLDirectMapping(); streetMapping.setAttributeName("street"); streetMapping.setXPath("street/text()"); descriptor.addMapping(streetMapping); XMLDirectMapping cityMapping = new XMLDirectMapping(); cityMapping.setAttributeName("city"); cityMapping.setXPath("city/text()"); descriptor.addMapping(cityMapping); XMLDirectMapping stateMapping = new XMLDirectMapping(); stateMapping.setAttributeName("state"); stateMapping.setXPath("state/text()"); descriptor.addMapping(stateMapping); XMLDirectMapping countryMapping = new XMLDirectMapping(); countryMapping.setAttributeName("country"); countryMapping.setXPath("country/text()"); descriptor.addMapping(countryMapping); this.addDescriptor(descriptor); }
public void addAddressDescriptor(boolean methodAccess) { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(Address.class); XMLDirectMapping streetMapping = new XMLDirectMapping(); streetMapping.setAttributeName("street"); streetMapping.setXPath("street/text()"); descriptor.addMapping(streetMapping); XMLDirectMapping cityMapping = new XMLDirectMapping(); cityMapping.setAttributeName("city"); cityMapping.setXPath("city/text()"); descriptor.addMapping(cityMapping); XMLDirectMapping stateMapping = new XMLDirectMapping(); stateMapping.setAttributeName("state"); stateMapping.setXPath("state/text()"); descriptor.addMapping(stateMapping); XMLDirectMapping countryMapping = new XMLDirectMapping(); countryMapping.setAttributeName("country"); countryMapping.setXPath("country/text()"); descriptor.addMapping(countryMapping); XMLInverseReferenceMapping owningEmployee = new XMLInverseReferenceMapping(); owningEmployee.setReferenceClass(Employee.class); owningEmployee.setMappedBy("address"); owningEmployee.setAttributeName("owningEmployee"); if (methodAccess) { owningEmployee.setSetMethodName("setOwningEmployee"); owningEmployee.setGetMethodName("getOwningEmployee"); } descriptor.addMapping(owningEmployee); this.addDescriptor(descriptor); }