本文整理了Java中org.eclipse.persistence.oxm.mappings.XMLDirectMapping.setAttributeClassification()
方法的一些代码示例,展示了XMLDirectMapping.setAttributeClassification()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLDirectMapping.setAttributeClassification()
方法的具体详情如下:
包路径:org.eclipse.persistence.oxm.mappings.XMLDirectMapping
类名称:XMLDirectMapping
方法名:setAttributeClassification
暂无
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
protected ClassDescriptor buildTypedAssociationDescriptor() {
ClassDescriptor descriptor = super.buildTypedAssociationDescriptor();
XMLDirectMapping keyMapping = (XMLDirectMapping)descriptor.getMappingForAttributeName("key");
keyMapping.setAttributeClassification(null);
keyMapping.setGetMethodName("getKey");
keyMapping.setSetMethodName("setKey");
return descriptor;
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
protected ClassDescriptor buildTypedAssociationDescriptor() {
ClassDescriptor descriptor = super.buildTypedAssociationDescriptor();
XMLDirectMapping keyMapping = (XMLDirectMapping)descriptor.getMappingForAttributeName("key");
keyMapping.setAttributeClassification(null);
keyMapping.setGetMethodName("getKey");
keyMapping.setSetMethodName("setKey");
return descriptor;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
protected ClassDescriptor buildTypedAssociationDescriptor() {
ClassDescriptor descriptor = super.buildTypedAssociationDescriptor();
XMLDirectMapping keyMapping = (XMLDirectMapping)descriptor.getMappingForAttributeName("key");
keyMapping.setAttributeClassification(null);
keyMapping.setGetMethodName("getKey");
keyMapping.setSetMethodName("setKey");
return descriptor;
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
private void addChoiceElementMapping(XMLField xmlField, Class theClass){
if (xmlField.getLastXPathFragment().nameIsText()) {
XMLDirectMapping xmlMapping = new XMLDirectMapping();
xmlMapping.setAttributeClassification(theClass);
xmlMapping.setAttributeAccessor(temporaryAccessor);
xmlMapping.setField(xmlField);
this.choiceElementMappings.put(xmlField, xmlMapping);
} else {
XMLCompositeObjectMapping xmlMapping = new XMLCompositeObjectMapping();
xmlMapping.setAttributeAccessor(temporaryAccessor);
if(!theClass.equals(ClassConstants.OBJECT)){
xmlMapping.setReferenceClass(theClass);
}
xmlMapping.setField(xmlField);
this.choiceElementMappings.put(xmlField, xmlMapping);
}
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
private void addChoiceElementMapping(XMLField xmlField, String className){
if (xmlField.getLastXPathFragment().nameIsText()) {
XMLDirectMapping xmlMapping = new XMLDirectMapping();
xmlMapping.setAttributeAccessor(temporaryAccessor);
Class theClass = XMLConversionManager.getDefaultXMLManager().convertClassNameToClass(className);
xmlMapping.setAttributeClassification(theClass);
xmlMapping.setField(xmlField);
this.choiceElementMappings.put(xmlField, xmlMapping);
} else {
XMLCompositeObjectMapping xmlMapping = new XMLCompositeObjectMapping();
xmlMapping.setAttributeAccessor(temporaryAccessor);
if(!className.equals("java.lang.Object")){
xmlMapping.setReferenceClassName(className);
}
xmlMapping.setField(xmlField);
this.choiceElementMappings.put(xmlField, xmlMapping);
}
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
private void addChoiceElementMapping(XMLField xmlField, Class theClass){
if (xmlField.getLastXPathFragment().nameIsText() || xmlField.getLastXPathFragment().isAttribute()) {
XMLDirectMapping xmlMapping = new XMLDirectMapping();
xmlMapping.setAttributeClassification(theClass);
xmlMapping.setAttributeAccessor(temporaryAccessor);
xmlMapping.setField(xmlField);
this.choiceElementMappings.put(xmlField, xmlMapping);
this.choiceElementMappingsByClass.put(theClass, xmlMapping);
} else {
if(isBinaryType(theClass)) {
XMLBinaryDataMapping xmlMapping = new XMLBinaryDataMapping();
xmlMapping.setField(xmlField);
xmlMapping.setAttributeClassification(theClass);
xmlMapping.setAttributeAccessor(temporaryAccessor);
this.choiceElementMappings.put(xmlField, xmlMapping);
this.choiceElementMappingsByClass.put(theClass, xmlMapping);
} else {
XMLCompositeObjectMapping xmlMapping = new XMLCompositeObjectMapping();
xmlMapping.setAttributeAccessor(temporaryAccessor);
if(!theClass.equals(ClassConstants.OBJECT)){
xmlMapping.setReferenceClass(theClass);
}
xmlMapping.setField(xmlField);
this.choiceElementMappings.put(xmlField, xmlMapping);
this.choiceElementMappingsByClass.put(theClass, xmlMapping);
}
}
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
private void addChoiceElementMapping(XMLField xmlField, Class theClass){
if (xmlField.getLastXPathFragment().nameIsText() || xmlField.getLastXPathFragment().isAttribute()) {
XMLDirectMapping xmlMapping = new XMLDirectMapping();
xmlMapping.setAttributeClassification(theClass);
xmlMapping.setAttributeAccessor(temporaryAccessor);
xmlMapping.setField(xmlField);
this.choiceElementMappings.put(xmlField, xmlMapping);
this.choiceElementMappingsByClass.put(theClass, xmlMapping);
} else {
if(isBinaryType(theClass)) {
XMLBinaryDataMapping xmlMapping = new XMLBinaryDataMapping();
xmlMapping.setField(xmlField);
xmlMapping.setAttributeClassification(theClass);
xmlMapping.setAttributeAccessor(temporaryAccessor);
this.choiceElementMappings.put(xmlField, xmlMapping);
this.choiceElementMappingsByClass.put(theClass, xmlMapping);
} else {
XMLCompositeObjectMapping xmlMapping = new XMLCompositeObjectMapping();
xmlMapping.setAttributeAccessor(temporaryAccessor);
if(!theClass.equals(ClassConstants.OBJECT)){
xmlMapping.setReferenceClass(theClass);
}
xmlMapping.setField(xmlField);
this.choiceElementMappings.put(xmlField, xmlMapping);
this.choiceElementMappingsByClass.put(theClass, xmlMapping);
}
}
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
protected ClassDescriptor buildTypedAssociationDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(TypedAssociation.class);
descriptor.setDefaultRootElement("class-indicator-mapping");
descriptor.getEventManager().setPostBuildSelector("postBuild");
XMLDirectMapping keyMapping = new XMLDirectMapping();
keyMapping.setAttributeClassification(Class.class);
keyMapping.setAttributeName("key");
keyMapping.setGetMethodName("getKey");
keyMapping.setSetMethodName("setKey");
keyMapping.setXPath(getPrimaryNamespaceXPath() + "class/text()");
descriptor.addMapping(keyMapping);
XMLDirectMapping valueMapping = new XMLDirectMapping();
valueMapping.setAttributeName("value");
valueMapping.setGetMethodName("getValue");
valueMapping.setSetMethodName("setValue");
valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "class-indicator/text()"));
descriptor.addMapping(valueMapping);
return descriptor;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
protected ClassDescriptor buildTypedAssociationDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(TypedAssociation.class);
descriptor.setDefaultRootElement("class-indicator-mapping");
descriptor.getEventManager().setPostBuildSelector("postBuild");
XMLDirectMapping keyMapping = new XMLDirectMapping();
keyMapping.setAttributeClassification(Class.class);
keyMapping.setAttributeName("key");
keyMapping.setGetMethodName("getKey");
keyMapping.setSetMethodName("setKey");
keyMapping.setXPath(getPrimaryNamespaceXPath() + "class/text()");
descriptor.addMapping(keyMapping);
XMLDirectMapping valueMapping = new XMLDirectMapping();
valueMapping.setAttributeName("value");
valueMapping.setGetMethodName("getValue");
valueMapping.setSetMethodName("setValue");
valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "class-indicator/text()"));
descriptor.addMapping(valueMapping);
return descriptor;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.sdo
private void initializeDescriptor(XMLDescriptor aDescriptor, QName aQName, Type aPropertyType, SDOProperty aValueProperty) {
aDescriptor.setNamespaceResolver(null);
SDOMethodAttributeAccessor accessor = null;
accessor = new SDOMethodAttributeAccessor(aValueProperty);
if (XMLConstants.QNAME_QNAME.equals(aQName)) {
XMLTransformationMapping mapping = new XMLTransformationMapping();
mapping.setAttributeName(ATTRIBUTE_NAME);
QNameTransformer transformer = new QNameTransformer("text()");
mapping.setAttributeTransformer(transformer);
mapping.addFieldTransformer(XPATH, transformer);
NamespaceResolver nsr = new NamespaceResolver();
nsr.setDefaultNamespaceURI(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI);
XMLField field = new XMLField();
field.setNamespaceResolver(nsr);
field.setXPath("@" + javax.xml.XMLConstants.XMLNS_ATTRIBUTE);
mapping.addFieldTransformer(field, new NamespaceURITransformer());
mapping.setAttributeAccessor(accessor);
aDescriptor.addMapping(mapping);
} else {
XMLDirectMapping mapping = new XMLDirectMapping();
mapping.setAttributeName(ATTRIBUTE_NAME);
mapping.setXPath(XPATH);
mapping.setAttributeClassification(aPropertyType.getInstanceClass());
((XMLField) mapping.getField()).setSchemaType(aQName);
mapping.setAttributeAccessor(accessor);
aDescriptor.addMapping(mapping);
}
aDescriptor.setIsWrapper(true);
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
private void initializeDescriptor(XMLDescriptor aDescriptor, QName aQName, Type aPropertyType, SDOProperty aValueProperty) {
aDescriptor.setNamespaceResolver(null);
SDOMethodAttributeAccessor accessor = null;
accessor = new SDOMethodAttributeAccessor(aValueProperty);
if (XMLConstants.QNAME_QNAME.equals(aQName)) {
XMLTransformationMapping mapping = new XMLTransformationMapping();
mapping.setAttributeName(ATTRIBUTE_NAME);
QNameTransformer transformer = new QNameTransformer("text()");
mapping.setAttributeTransformer(transformer);
mapping.addFieldTransformer(XPATH, transformer);
NamespaceResolver nsr = new NamespaceResolver();
nsr.setDefaultNamespaceURI(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI);
XMLField field = new XMLField();
field.setNamespaceResolver(nsr);
field.setXPath("@" + javax.xml.XMLConstants.XMLNS_ATTRIBUTE);
mapping.addFieldTransformer(field, new NamespaceURITransformer());
mapping.setAttributeAccessor(accessor);
aDescriptor.addMapping(mapping);
} else {
XMLDirectMapping mapping = new XMLDirectMapping();
mapping.setAttributeName(ATTRIBUTE_NAME);
mapping.setXPath(XPATH);
mapping.setAttributeClassification(aPropertyType.getInstanceClass());
((XMLField) mapping.getField()).setSchemaType(aQName);
mapping.setAttributeAccessor(accessor);
aDescriptor.addMapping(mapping);
}
aDescriptor.setIsWrapper(true);
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
protected ClassDescriptor buildTypedAssociationDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(TypedAssociation.class);
descriptor.setDefaultRootElement("class-indicator-mapping");
descriptor.getEventManager().setPostBuildSelector("postBuild");
XMLDirectMapping keyMapping = new XMLDirectMapping();
keyMapping.setAttributeClassification(Class.class);
keyMapping.setAttributeName("key");
keyMapping.setGetMethodName("getKey");
keyMapping.setSetMethodName("setKey");
keyMapping.setXPath(getPrimaryNamespaceXPath() + "class/text()");
descriptor.addMapping(keyMapping);
XMLDirectMapping valueMapping = new XMLDirectMapping();
valueMapping.setAttributeName("value");
valueMapping.setGetMethodName("getValue");
valueMapping.setSetMethodName("setValue");
valueMapping.setField(buildTypedField(getPrimaryNamespaceXPath() + "class-indicator/text()"));
descriptor.addMapping(valueMapping);
return descriptor;
}
内容来源于网络,如有侵权,请联系作者删除!