org.eclipse.persistence.oxm.mappings.XMLDirectMapping.setField()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(17.6k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.eclipse.persistence.oxm.mappings.XMLDirectMapping.setField()方法的一些代码示例,展示了XMLDirectMapping.setField()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLDirectMapping.setField()方法的具体详情如下:
包路径:org.eclipse.persistence.oxm.mappings.XMLDirectMapping
类名称:XMLDirectMapping
方法名:setField

XMLDirectMapping.setField介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

  1. /**
  2. * Set the Mapping field name attribute to the given XPath String
  3. * @param xpathString String
  4. */
  5. public void setXPath(String xpathString) {
  6. if ((xpathString.indexOf(XMLConstants.ATTRIBUTE) == -1) && (!xpathString.endsWith(XMLConstants.TEXT))) {
  7. xpathString += '/' + XMLConstants.TEXT;
  8. }
  9. setField(new XMLField(xpathString));
  10. }
  11. public void initialize(AbstractSession session) throws DescriptorException {

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

  1. /**
  2. * Set the Mapping field name attribute to the given XPath String
  3. * @param xpathString String
  4. */
  5. public void setXPath(String xpathString) {
  6. if ((xpathString.indexOf(XMLConstants.ATTRIBUTE) == -1) && (!xpathString.endsWith(XMLConstants.TEXT))) {
  7. xpathString += '/' + XMLConstants.TEXT;
  8. }
  9. setField(new XMLField(xpathString));
  10. }
  11. public void initialize(AbstractSession session) throws DescriptorException {

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

  1. /**
  2. * Set the Mapping field name attribute to the given XPath String
  3. * @param xpathString String
  4. */
  5. public void setXPath(String xpathString) {
  6. if ((xpathString.indexOf(XMLConstants.ATTRIBUTE) == -1) && (!xpathString.endsWith(XMLConstants.TEXT))) {
  7. xpathString += '/' + XMLConstants.TEXT;
  8. }
  9. setField(new XMLField(xpathString));
  10. }
  11. public void initialize(AbstractSession session) throws DescriptorException {

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

  1. private void addChoiceElementMapping(XMLField xmlField, Class theClass){
  2. if (xmlField.getLastXPathFragment().nameIsText()) {
  3. XMLDirectMapping xmlMapping = new XMLDirectMapping();
  4. xmlMapping.setAttributeClassification(theClass);
  5. xmlMapping.setAttributeAccessor(temporaryAccessor);
  6. xmlMapping.setField(xmlField);
  7. this.choiceElementMappings.put(xmlField, xmlMapping);
  8. } else {
  9. XMLCompositeObjectMapping xmlMapping = new XMLCompositeObjectMapping();
  10. xmlMapping.setAttributeAccessor(temporaryAccessor);
  11. if(!theClass.equals(ClassConstants.OBJECT)){
  12. xmlMapping.setReferenceClass(theClass);
  13. }
  14. xmlMapping.setField(xmlField);
  15. this.choiceElementMappings.put(xmlField, xmlMapping);
  16. }
  17. }

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

  1. private void addChoiceElementMapping(XMLField xmlField, String className){
  2. if (xmlField.getLastXPathFragment().nameIsText()) {
  3. XMLDirectMapping xmlMapping = new XMLDirectMapping();
  4. xmlMapping.setAttributeAccessor(temporaryAccessor);
  5. Class theClass = XMLConversionManager.getDefaultXMLManager().convertClassNameToClass(className);
  6. xmlMapping.setAttributeClassification(theClass);
  7. xmlMapping.setField(xmlField);
  8. this.choiceElementMappings.put(xmlField, xmlMapping);
  9. } else {
  10. XMLCompositeObjectMapping xmlMapping = new XMLCompositeObjectMapping();
  11. xmlMapping.setAttributeAccessor(temporaryAccessor);
  12. if(!className.equals("java.lang.Object")){
  13. xmlMapping.setReferenceClassName(className);
  14. }
  15. xmlMapping.setField(xmlField);
  16. this.choiceElementMappings.put(xmlField, xmlMapping);
  17. }
  18. }

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

  1. protected ClassDescriptor buildConstantExpressionDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(ConstantExpression.class);
  4. descriptor.setDefaultRootElement("constant-expression");
  5. descriptor.getInheritancePolicy().setParentClass(Expression.class);
  6. XMLDirectMapping valueMapping = new XMLDirectMapping();
  7. valueMapping.setAttributeName("value");
  8. valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "value/text()"));
  9. descriptor.addMapping(valueMapping);
  10. return descriptor;
  11. }

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

  1. protected ClassDescriptor buildConstantExpressionDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(ConstantExpression.class);
  4. descriptor.setDefaultRootElement("constant-expression");
  5. descriptor.getInheritancePolicy().setParentClass(Expression.class);
  6. XMLDirectMapping valueMapping = new XMLDirectMapping();
  7. valueMapping.setAttributeName("value");
  8. valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "value/text()"));
  9. descriptor.addMapping(valueMapping);
  10. return descriptor;
  11. }

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

  1. protected ClassDescriptor buildConstantExpressionDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(ConstantExpression.class);
  4. descriptor.setDefaultRootElement("constant-expression");
  5. descriptor.getInheritancePolicy().setParentClass(Expression.class);
  6. XMLDirectMapping valueMapping = new XMLDirectMapping();
  7. valueMapping.setAttributeName("value");
  8. valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "value/text()"));
  9. descriptor.addMapping(valueMapping);
  10. return descriptor;
  11. }

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

  1. protected ClassDescriptor buildTypeMappingDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(TypeMapping.class);
  4. descriptor.setDefaultRootElement("type-mapping");
  5. descriptor.getEventManager().setPostBuildSelector("postBuild");
  6. XMLDirectMapping valueMapping = new XMLDirectMapping();
  7. valueMapping.setAttributeName("value");
  8. valueMapping.setGetMethodName("getValue");
  9. valueMapping.setSetMethodName("setValue");
  10. valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "object-value/text()"));
  11. descriptor.addMapping(valueMapping);
  12. XMLDirectMapping keyMapping = new XMLDirectMapping();
  13. keyMapping.setAttributeName("key");
  14. keyMapping.setGetMethodName("getKey");
  15. keyMapping.setSetMethodName("setKey");
  16. keyMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "data-value/text()"));
  17. descriptor.addMapping(keyMapping);
  18. return descriptor;
  19. }

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

  1. protected ClassDescriptor buildTypeMappingDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(TypeMapping.class);
  4. descriptor.setDefaultRootElement("type-mapping");
  5. descriptor.getEventManager().setPostBuildSelector("postBuild");
  6. XMLDirectMapping valueMapping = new XMLDirectMapping();
  7. valueMapping.setAttributeName("value");
  8. valueMapping.setGetMethodName("getValue");
  9. valueMapping.setSetMethodName("setValue");
  10. valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "object-value/text()"));
  11. descriptor.addMapping(valueMapping);
  12. XMLDirectMapping keyMapping = new XMLDirectMapping();
  13. keyMapping.setAttributeName("key");
  14. keyMapping.setGetMethodName("getKey");
  15. keyMapping.setSetMethodName("setKey");
  16. keyMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "data-value/text()"));
  17. descriptor.addMapping(keyMapping);
  18. return descriptor;
  19. }

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

  1. protected ClassDescriptor buildTypeMappingDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(TypeMapping.class);
  4. descriptor.setDefaultRootElement("type-mapping");
  5. descriptor.getEventManager().setPostBuildSelector("postBuild");
  6. XMLDirectMapping valueMapping = new XMLDirectMapping();
  7. valueMapping.setAttributeName("value");
  8. valueMapping.setGetMethodName("getValue");
  9. valueMapping.setSetMethodName("setValue");
  10. valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "object-value/text()"));
  11. descriptor.addMapping(valueMapping);
  12. XMLDirectMapping keyMapping = new XMLDirectMapping();
  13. keyMapping.setAttributeName("key");
  14. keyMapping.setGetMethodName("getKey");
  15. keyMapping.setSetMethodName("setKey");
  16. keyMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "data-value/text()"));
  17. descriptor.addMapping(keyMapping);
  18. return descriptor;
  19. }

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

  1. protected ClassDescriptor buildDailyCacheInvalidationPolicyDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(DailyCacheInvalidationPolicy.class);
  4. descriptor.getInheritancePolicy().setParentClass(CacheInvalidationPolicy.class);
  5. XMLDirectMapping expiryMinuteMapping = new XMLDirectMapping();
  6. expiryMinuteMapping.setAttributeName("expiryTime");
  7. expiryMinuteMapping.setGetMethodName("getExpiryTime");
  8. expiryMinuteMapping.setSetMethodName("setExpiryTime");
  9. XMLField expiryTimeField = new XMLField(getPrimaryNamespaceXPath() + "expiry-time/text()");
  10. expiryTimeField.setIsTypedTextField(true);
  11. expiryMinuteMapping.setField(expiryTimeField);
  12. descriptor.addMapping(expiryMinuteMapping);
  13. return descriptor;
  14. }

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

  1. protected ClassDescriptor buildDailyCacheInvalidationPolicyDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(DailyCacheInvalidationPolicy.class);
  4. descriptor.getInheritancePolicy().setParentClass(CacheInvalidationPolicy.class);
  5. XMLDirectMapping expiryMinuteMapping = new XMLDirectMapping();
  6. expiryMinuteMapping.setAttributeName("expiryTime");
  7. expiryMinuteMapping.setGetMethodName("getExpiryTime");
  8. expiryMinuteMapping.setSetMethodName("setExpiryTime");
  9. XMLField expiryTimeField = new XMLField(getPrimaryNamespaceXPath() + "expiry-time/text()");
  10. expiryTimeField.setIsTypedTextField(true);
  11. expiryMinuteMapping.setField(expiryTimeField);
  12. descriptor.addMapping(expiryMinuteMapping);
  13. return descriptor;
  14. }

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

  1. protected ClassDescriptor buildDailyCacheInvalidationPolicyDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(DailyCacheInvalidationPolicy.class);
  4. descriptor.getInheritancePolicy().setParentClass(CacheInvalidationPolicy.class);
  5. XMLDirectMapping expiryMinuteMapping = new XMLDirectMapping();
  6. expiryMinuteMapping.setAttributeName("expiryTime");
  7. expiryMinuteMapping.setGetMethodName("getExpiryTime");
  8. expiryMinuteMapping.setSetMethodName("setExpiryTime");
  9. XMLField expiryTimeField = new XMLField(getPrimaryNamespaceXPath() + "expiry-time/text()");
  10. expiryTimeField.setIsTypedTextField(true);
  11. expiryMinuteMapping.setField(expiryTimeField);
  12. descriptor.addMapping(expiryMinuteMapping);
  13. return descriptor;
  14. }

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

  1. protected ClassDescriptor buildTypedAssociationDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(TypedAssociation.class);
  4. descriptor.setDefaultRootElement("class-indicator-mapping");
  5. descriptor.getEventManager().setPostBuildSelector("postBuild");
  6. XMLDirectMapping keyMapping = new XMLDirectMapping();
  7. keyMapping.setAttributeClassification(Class.class);
  8. keyMapping.setAttributeName("key");
  9. keyMapping.setGetMethodName("getKey");
  10. keyMapping.setSetMethodName("setKey");
  11. keyMapping.setXPath(getPrimaryNamespaceXPath() + "class/text()");
  12. descriptor.addMapping(keyMapping);
  13. XMLDirectMapping valueMapping = new XMLDirectMapping();
  14. valueMapping.setAttributeName("value");
  15. valueMapping.setGetMethodName("getValue");
  16. valueMapping.setSetMethodName("setValue");
  17. valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "class-indicator/text()"));
  18. descriptor.addMapping(valueMapping);
  19. return descriptor;
  20. }

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

  1. protected ClassDescriptor buildTypedAssociationDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(TypedAssociation.class);
  4. descriptor.setDefaultRootElement("class-indicator-mapping");
  5. descriptor.getEventManager().setPostBuildSelector("postBuild");
  6. XMLDirectMapping keyMapping = new XMLDirectMapping();
  7. keyMapping.setAttributeClassification(Class.class);
  8. keyMapping.setAttributeName("key");
  9. keyMapping.setGetMethodName("getKey");
  10. keyMapping.setSetMethodName("setKey");
  11. keyMapping.setXPath(getPrimaryNamespaceXPath() + "class/text()");
  12. descriptor.addMapping(keyMapping);
  13. XMLDirectMapping valueMapping = new XMLDirectMapping();
  14. valueMapping.setAttributeName("value");
  15. valueMapping.setGetMethodName("getValue");
  16. valueMapping.setSetMethodName("setValue");
  17. valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "class-indicator/text()"));
  18. descriptor.addMapping(valueMapping);
  19. return descriptor;
  20. }

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

  1. protected ClassDescriptor buildTypedAssociationDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(TypedAssociation.class);
  4. descriptor.setDefaultRootElement("class-indicator-mapping");
  5. descriptor.getEventManager().setPostBuildSelector("postBuild");
  6. XMLDirectMapping keyMapping = new XMLDirectMapping();
  7. keyMapping.setAttributeClassification(Class.class);
  8. keyMapping.setAttributeName("key");
  9. keyMapping.setGetMethodName("getKey");
  10. keyMapping.setSetMethodName("setKey");
  11. keyMapping.setXPath(getPrimaryNamespaceXPath() + "class/text()");
  12. descriptor.addMapping(keyMapping);
  13. XMLDirectMapping valueMapping = new XMLDirectMapping();
  14. valueMapping.setAttributeName("value");
  15. valueMapping.setGetMethodName("getValue");
  16. valueMapping.setSetMethodName("setValue");
  17. valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "class-indicator/text()"));
  18. descriptor.addMapping(valueMapping);
  19. return descriptor;
  20. }

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

  1. protected ClassDescriptor buildInteractionArgumentDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(InteractionArgument.class);
  4. descriptor.setDefaultRootElement("interaction-argument");
  5. XMLDirectMapping argumentNameMapping = new XMLDirectMapping();
  6. argumentNameMapping.setAttributeName("argumentName");
  7. argumentNameMapping.setGetMethodName("getArgumentName");
  8. argumentNameMapping.setSetMethodName("setArgumentName");
  9. argumentNameMapping.setXPath("@name");
  10. descriptor.addMapping(argumentNameMapping);
  11. XMLDirectMapping keyMapping = new XMLDirectMapping();
  12. keyMapping.setAttributeName("key");
  13. keyMapping.setGetMethodName("getKey");
  14. keyMapping.setSetMethodName("setKey");
  15. keyMapping.setXPath("@argument-name");
  16. descriptor.addMapping(keyMapping);
  17. XMLDirectMapping valueMapping = new XMLDirectMapping();
  18. valueMapping.setAttributeName("value");
  19. valueMapping.setGetMethodName("getValue");
  20. valueMapping.setSetMethodName("setValue");
  21. valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "argument-value/text()"));
  22. descriptor.addMapping(valueMapping);
  23. return descriptor;
  24. }

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

  1. protected ClassDescriptor buildInteractionArgumentDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(InteractionArgument.class);
  4. descriptor.setDefaultRootElement("interaction-argument");
  5. XMLDirectMapping argumentNameMapping = new XMLDirectMapping();
  6. argumentNameMapping.setAttributeName("argumentName");
  7. argumentNameMapping.setGetMethodName("getArgumentName");
  8. argumentNameMapping.setSetMethodName("setArgumentName");
  9. argumentNameMapping.setXPath("@name");
  10. descriptor.addMapping(argumentNameMapping);
  11. XMLDirectMapping keyMapping = new XMLDirectMapping();
  12. keyMapping.setAttributeName("key");
  13. keyMapping.setGetMethodName("getKey");
  14. keyMapping.setSetMethodName("setKey");
  15. keyMapping.setXPath("@argument-name");
  16. descriptor.addMapping(keyMapping);
  17. XMLDirectMapping valueMapping = new XMLDirectMapping();
  18. valueMapping.setAttributeName("value");
  19. valueMapping.setGetMethodName("getValue");
  20. valueMapping.setSetMethodName("setValue");
  21. valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "argument-value/text()"));
  22. descriptor.addMapping(valueMapping);
  23. return descriptor;
  24. }

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

  1. protected ClassDescriptor buildAbstractDirectMappingDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(AbstractDirectMapping.class);
  4. descriptor.getInheritancePolicy().setParentClass(DatabaseMapping.class);
  5. XMLCompositeObjectMapping fieldMapping = new XMLCompositeObjectMapping();
  6. fieldMapping.setAttributeName("field");
  7. fieldMapping.setReferenceClass(DatabaseField.class);
  8. fieldMapping.setGetMethodName("getField");
  9. fieldMapping.setSetMethodName("setField");
  10. fieldMapping.setXPath(getSecondaryNamespaceXPath() + "field");
  11. descriptor.addMapping(fieldMapping);
  12. XMLDirectMapping nullValueMapping = new XMLDirectMapping();
  13. nullValueMapping.setAttributeName("nullValue");
  14. nullValueMapping.setGetMethodName("getNullValue");
  15. nullValueMapping.setSetMethodName("setNullValue");
  16. nullValueMapping.setField(buildTypedField(getSecondaryNamespaceXPath() + "null-value/text()"));
  17. descriptor.addMapping(nullValueMapping);
  18. XMLCompositeObjectMapping converterMapping = new XMLCompositeObjectMapping();
  19. converterMapping.setAttributeName("converter");
  20. converterMapping.setGetMethodName("getConverter");
  21. converterMapping.setSetMethodName("setConverter");
  22. converterMapping.setXPath(getSecondaryNamespaceXPath() + "converter");
  23. converterMapping.setReferenceClass(Converter.class);
  24. descriptor.addMapping(converterMapping);
  25. return descriptor;
  26. }

相关文章