/** * Set the Mapping field name attribute to the given XPath String * @param xpathString String */ public void setXPath(String xpathString) { if ((xpathString.indexOf(XMLConstants.ATTRIBUTE) == -1) && (!xpathString.endsWith(XMLConstants.TEXT))) { xpathString += '/' + XMLConstants.TEXT; } setField(new XMLField(xpathString)); }
/** * Set the Mapping field name attribute to the given XPath String * @param xpathString String */ public void setXPath(String xpathString) { if ((xpathString.indexOf(XMLConstants.ATTRIBUTE) == -1) && (!xpathString.endsWith(XMLConstants.TEXT))) { xpathString += '/' + XMLConstants.TEXT; } setField(new XMLField(xpathString)); }
/** * Set the Mapping field name attribute to the given XPath String * @param xpathString String */ public void setXPath(String xpathString) { if ((xpathString.indexOf(XMLConstants.ATTRIBUTE) == -1) && (!xpathString.endsWith(XMLConstants.TEXT))) { xpathString += '/' + XMLConstants.TEXT; } setField(new XMLField(xpathString)); }
/** * PUBLIC: * Allows the user to indicate that this mapping should also allow for mixed content in addition to * any of the elements in the choice. The grouping element parameter is used in the case that there is * a common grouping element to all the other elements in this choice. If so, that grouping element can * be specified here to allow the mixed content to be written/detected inside the wrapper element. * @since EclipseLink 2.3.1 */ public void setMixedContent(String groupingElement) { isMixedContent = true; String xpath = groupingElement; if(groupingElement.length() == 0) { xpath = "text()"; } else { xpath += "/" + "text()"; } XMLField field = new XMLField(xpath); XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping(); Class theClass = ClassConstants.STRING; xmlMapping.setAttributeElementClass(theClass); xmlMapping.setField(field); xmlMapping.setAttributeAccessor(temporaryAccessor); this.mixedContentMapping = xmlMapping; this.choiceElementMappings.put(field, xmlMapping); }
/** * PUBLIC: * Allows the user to indicate that this mapping should also allow for mixed content in addition to * any of the elements in the choice. The grouping element parameter is used in the case that there is * a common grouping element to all the other elements in this choice. If so, that grouping element can * be specified here to allow the mixed content to be written/detected inside the wrapper element. * @since EclipseLink 2.3.1 */ public void setMixedContent(String groupingElement) { isMixedContent = true; String xpath = groupingElement; if(groupingElement.length() == 0) { xpath = "text()"; } else { xpath += "/" + "text()"; } XMLField field = new XMLField(xpath); XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping(); Class theClass = ClassConstants.STRING; xmlMapping.setAttributeElementClass(theClass); xmlMapping.setField(field); xmlMapping.setAttributeAccessor(temporaryAccessor); this.mixedContentMapping = xmlMapping; this.choiceElementMappings.put(field, xmlMapping); }
private void addChoiceElementMapping(XMLField xmlField, Class theClass){ if (xmlField.getLastXPathFragment().nameIsText()) { XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping(); xmlMapping.setAttributeElementClass(theClass); xmlMapping.setField(xmlField); xmlMapping.setAttributeAccessor(temporaryAccessor); this.choiceElementMappings.put(xmlField, xmlMapping); } else { XMLCompositeCollectionMapping xmlMapping = new XMLCompositeCollectionMapping(); if(!theClass.equals(ClassConstants.OBJECT)){ xmlMapping.setReferenceClass(theClass); } xmlMapping.setField(xmlField); xmlMapping.setAttributeAccessor(temporaryAccessor); this.choiceElementMappings.put(xmlField, xmlMapping); } }
XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping(); xmlMapping.setAttributeElementClass(theClass); xmlMapping.setField(xmlField); xmlMapping.setAttributeAccessor(temporaryAccessor); this.choiceElementMappings.put(xmlField, xmlMapping);
private void addChoiceElementMapping(XMLField xmlField, String className){ if (xmlField.getLastXPathFragment().nameIsText()) { XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping(); Class theClass = XMLConversionManager.getDefaultXMLManager().convertClassNameToClass(className); xmlMapping.setAttributeElementClass(theClass); xmlMapping.setField(xmlField); xmlMapping.setAttributeAccessor(temporaryAccessor); this.choiceElementMappings.put(xmlField, xmlMapping); } else { XMLCompositeCollectionMapping xmlMapping = new XMLCompositeCollectionMapping(); if(!className.equals("java.lang.Object")){ xmlMapping.setReferenceClassName(className); } xmlMapping.setField(xmlField); xmlMapping.setAttributeAccessor(temporaryAccessor); this.choiceElementMappings.put(xmlField, xmlMapping); } }
private void addChoiceElementMapping(XMLField xmlField, Class theClass){ if (xmlField.getLastXPathFragment().nameIsText() || xmlField.getLastXPathFragment().isAttribute()) { XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping(); xmlMapping.setAttributeElementClass(theClass); xmlMapping.setField(xmlField); xmlMapping.setAttributeAccessor(temporaryAccessor); this.choiceElementMappings.put(xmlField, xmlMapping); this.choiceElementMappingsByClass.put(theClass, xmlMapping); } else { if(isBinaryType(theClass)) { XMLBinaryDataCollectionMapping xmlMapping = new XMLBinaryDataCollectionMapping(); xmlMapping.setField(xmlField); xmlMapping.setAttributeElementClass(theClass); xmlMapping.setAttributeAccessor(temporaryAccessor); this.fieldsToConverters.put(xmlField, xmlMapping.getValueConverter()); this.choiceElementMappings.put(xmlField, xmlMapping); this.choiceElementMappingsByClass.put(theClass, xmlMapping); } else { XMLCompositeCollectionMapping xmlMapping = new XMLCompositeCollectionMapping(); if(!theClass.equals(ClassConstants.OBJECT)){ xmlMapping.setReferenceClass(theClass); } xmlMapping.setField(xmlField); xmlMapping.setAttributeAccessor(temporaryAccessor); this.choiceElementMappings.put(xmlField, xmlMapping); this.choiceElementMappingsByClass.put(theClass, xmlMapping); } } }
private void addChoiceElementMapping(XMLField xmlField, String className){ if (xmlField.getLastXPathFragment().nameIsText() || xmlField.getLastXPathFragment().isAttribute()) { XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping(); xmlMapping.setAttributeElementClassName(className); xmlMapping.setField(xmlField); xmlMapping.setAttributeAccessor(temporaryAccessor); this.choiceElementMappings.put(xmlField, xmlMapping); this.choiceElementMappingsByClassName.put(className, xmlMapping); } else { if(isBinaryType(className)) { XMLBinaryDataCollectionMapping xmlMapping = new XMLBinaryDataCollectionMapping(); xmlMapping.setField(xmlField); xmlMapping.setAttributeAccessor(temporaryAccessor); Class theClass = XMLConversionManager.getDefaultXMLManager().convertClassNameToClass(className); xmlMapping.setAttributeElementClass(theClass); this.choiceElementMappings.put(xmlField, xmlMapping); this.choiceElementMappingsByClassName.put(className, xmlMapping); } else { XMLCompositeCollectionMapping xmlMapping = new XMLCompositeCollectionMapping(); if(!className.equals("java.lang.Object")){ xmlMapping.setReferenceClassName(className); } xmlMapping.setField(xmlField); xmlMapping.setAttributeAccessor(temporaryAccessor); this.choiceElementMappings.put(xmlField, xmlMapping); this.choiceElementMappingsByClassName.put(className, xmlMapping); } } }
private void addChoiceElementMapping(XMLField xmlField, String className){ if (xmlField.getLastXPathFragment().nameIsText() || xmlField.getLastXPathFragment().isAttribute()) { XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping(); xmlMapping.setAttributeElementClassName(className); xmlMapping.setField(xmlField); xmlMapping.setAttributeAccessor(temporaryAccessor); this.choiceElementMappings.put(xmlField, xmlMapping); this.choiceElementMappingsByClassName.put(className, xmlMapping); } else { if(isBinaryType(className)) { XMLBinaryDataCollectionMapping xmlMapping = new XMLBinaryDataCollectionMapping(); xmlMapping.setField(xmlField); xmlMapping.setAttributeAccessor(temporaryAccessor); Class theClass = XMLConversionManager.getDefaultXMLManager().convertClassNameToClass(className); xmlMapping.setAttributeElementClass(theClass); this.choiceElementMappings.put(xmlField, xmlMapping); this.choiceElementMappingsByClassName.put(className, xmlMapping); } else { XMLCompositeCollectionMapping xmlMapping = new XMLCompositeCollectionMapping(); if(!className.equals("java.lang.Object")){ xmlMapping.setReferenceClassName(className); } xmlMapping.setField(xmlField); xmlMapping.setAttributeAccessor(temporaryAccessor); this.choiceElementMappings.put(xmlField, xmlMapping); this.choiceElementMappingsByClassName.put(className, xmlMapping); } } }
/** * Build an XMLDescriptor for BatchQueryOperation. */ protected XMLDescriptor buildBatchQueryDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(BatchQueryOperation.class); descriptor.setDefaultRootElement("batch-sql-query"); XMLDirectMapping name = new XMLDirectMapping(); name.setAttributeName("name"); name.setXPath("name/text()"); descriptor.addMapping(name); XMLCompositeDirectCollectionMapping statementsMapping = new XMLCompositeDirectCollectionMapping(); statementsMapping.setAttributeName("batchSql"); XMLField f1 = new XMLField("batch-statement/text()"); f1.setIsCDATA(true); statementsMapping.setField(f1); descriptor.addMapping(statementsMapping); return descriptor; }
/** * Build an XMLDescriptor for BatchQueryOperation. */ protected XMLDescriptor buildBatchQueryDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(BatchQueryOperation.class); descriptor.setDefaultRootElement("batch-sql-query"); XMLDirectMapping name = new XMLDirectMapping(); name.setAttributeName("name"); name.setXPath("name/text()"); descriptor.addMapping(name); XMLCompositeDirectCollectionMapping statementsMapping = new XMLCompositeDirectCollectionMapping(); statementsMapping.setAttributeName("batchSql"); XMLField f1 = new XMLField("batch-statement/text()"); f1.setIsCDATA(true); statementsMapping.setField(f1); descriptor.addMapping(statementsMapping); return descriptor; }