本文整理了Java中org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping.getField()
方法的一些代码示例,展示了XMLCompositeCollectionMapping.getField()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLCompositeCollectionMapping.getField()
方法的具体详情如下:
包路径:org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping
类名称:XMLCompositeCollectionMapping
方法名:getField
暂无
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* Get the XPath String
* @return String the XPath String associated with this Mapping *
*/
public String getXPath() {
return getField().getName();
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* Get the XPath String
* @return String the XPath String associated with this Mapping *
*/
public String getXPath() {
return getField().getName();
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* Get the XPath String
* @return String the XPath String associated with this Mapping *
*/
public String getXPath() {
return getField().getName();
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
protected AbstractRecord buildCompositeRowForDescriptor(ClassDescriptor classDesc, Object attributeValue, AbstractSession session, XMLRecord parentRow, WriteType writeType) {
XMLObjectBuilder objectBuilder = (XMLObjectBuilder) classDesc.getObjectBuilder();
XMLRecord child = (XMLRecord) objectBuilder.createRecordFor(attributeValue, (XMLField) getField(), parentRow, this);
child.setNamespaceResolver(parentRow.getNamespaceResolver());
child.setSession(session);
objectBuilder.buildIntoNestedRow(child, attributeValue, session, (XMLDescriptor)getReferenceDescriptor(), (XMLField) getField());
return child;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
protected AbstractRecord buildCompositeRowForDescriptor(ClassDescriptor classDesc, Object attributeValue, AbstractSession session, XMLRecord parentRow, WriteType writeType) {
XMLObjectBuilder objectBuilder = (XMLObjectBuilder) classDesc.getObjectBuilder();
XMLRecord child = (XMLRecord) objectBuilder.createRecordFor(attributeValue, (XMLField) getField(), parentRow, this);
child.setNamespaceResolver(parentRow.getNamespaceResolver());
child.setSession(session);
objectBuilder.buildIntoNestedRow(child, attributeValue, session, (XMLDescriptor)getReferenceDescriptor(), (XMLField) getField());
return child;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
public void writeSingleValue(Object value, Object parent, XMLRecord record, AbstractSession session) {
Object element = convertObjectValueToDataValue(value, session, record.getMarshaller());
XMLRecord nestedRow = (XMLRecord) buildCompositeRow(element, session, record, WriteType.UNDEFINED);
record.add(getField(), nestedRow);
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
public void writeSingleValue(Object value, Object parent, XMLRecord record, AbstractSession session) {
Object element = convertObjectValueToDataValue(value, session, record.getMarshaller());
XMLRecord nestedRow = (XMLRecord) buildCompositeRow(element, session, record, WriteType.UNDEFINED);
record.add(getField(), nestedRow);
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
QName leafType = ((XMLField) getField()).getLastXPathFragment().getLeafElementType();
if (leafType != null) {
XPathFragment frag = new XPathFragment();
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
public void writeSingleValue(Object value, Object parent, XMLRecord record, AbstractSession session) {
Object element = value;
if (hasConverter()) {
if (getConverter() instanceof XMLConverter) {
element = ((XMLConverter) getConverter()).convertObjectValueToDataValue(element, session, record.getMarshaller());
} else {
element = getConverter().convertObjectValueToDataValue(element, session);
}
}
XMLRecord nestedRow = (XMLRecord) buildCompositeRow(element, session, record);
record.add(getField(), nestedRow);
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
row.put(this.getField(), null);
return;
fieldValue = this.getDescriptor().buildFieldValueFromNestedRows(nestedRows, getStructureName(), session);
row.put(this.getField(), fieldValue);
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, AbstractRecord parentRow) {
ClassDescriptor classDesc = null;
try{
classDesc = getReferenceDescriptor(attributeValue, session);
}catch(Exception e){
//do nothing
}
XMLField xmlFld = (XMLField) getField();
if (xmlFld.hasLastXPathFragment() && xmlFld.getLastXPathFragment().hasLeafElementType()) {
XMLRecord xmlRec = (XMLRecord) parentRow;
xmlRec.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());
}
XMLRecord parent = (XMLRecord) parentRow;
if (classDesc != null) {
XMLObjectBuilder objectBuilder = (XMLObjectBuilder) classDesc.getObjectBuilder();
boolean addXsiType = shouldAddXsiType((XMLRecord) parentRow, classDesc);
XMLRecord child = (XMLRecord) objectBuilder.createRecordFor(attributeValue, (XMLField) getField(), parent, this);
child.setNamespaceResolver(parent.getNamespaceResolver());
objectBuilder.buildIntoNestedRow(child, attributeValue, session, addXsiType);
return child;
} else {
if (attributeValue instanceof Element && getKeepAsElementPolicy() == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) {
return new DOMRecord((Element) attributeValue);
}else{
Node newNode = XPathEngine.getInstance().create((XMLField)getField(), parent.getDOM(), attributeValue, session);
DOMRecord newRow = new DOMRecord(newNode);
return newRow;
}
}
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
@Override
protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, AbstractRecord parentRow, WriteType writeType) {
ClassDescriptor classDesc = null;
try{
classDesc = getReferenceDescriptor(attributeValue, session);
}catch(Exception e){
//do nothing
}
XMLField xmlFld = (XMLField) getField();
if (xmlFld.hasLastXPathFragment() && xmlFld.getLastXPathFragment().hasLeafElementType()) {
XMLRecord xmlRec = (XMLRecord) parentRow;
xmlRec.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());
}
XMLRecord parent = (XMLRecord) parentRow;
if (classDesc != null) {
return buildCompositeRowForDescriptor(classDesc, attributeValue, session, parent, writeType);
} else {
if (attributeValue instanceof Element && getKeepAsElementPolicy() == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) {
return new DOMRecord((Element) attributeValue);
}else{
Node newNode = XPathEngine.getInstance().create((XMLField)getField(), parent.getDOM(), attributeValue, session);
DOMRecord newRow = new DOMRecord(newNode);
return newRow;
}
}
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
@Override
protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, AbstractRecord parentRow, WriteType writeType) {
ClassDescriptor classDesc = null;
try{
classDesc = getReferenceDescriptor(attributeValue, session);
}catch(Exception e){
//do nothing
}
XMLField xmlFld = (XMLField) getField();
if (xmlFld.hasLastXPathFragment() && xmlFld.getLastXPathFragment().hasLeafElementType()) {
XMLRecord xmlRec = (XMLRecord) parentRow;
xmlRec.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());
}
XMLRecord parent = (XMLRecord) parentRow;
if (classDesc != null) {
return buildCompositeRowForDescriptor(classDesc, attributeValue, session, parent, writeType);
} else {
if (attributeValue instanceof Element && getKeepAsElementPolicy() == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) {
return new DOMRecord((Element) attributeValue);
}else{
Node newNode = XPathEngine.getInstance().create((XMLField)getField(), parent.getDOM(), attributeValue, session);
DOMRecord newRow = new DOMRecord(newNode);
return newRow;
}
}
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
*/
public boolean shouldAddXsiType(XMLRecord record, ClassDescriptor descriptor) {
XMLDescriptor xmlDescriptor = (XMLDescriptor) descriptor;
if ((getReferenceDescriptor() == null) && (xmlDescriptor.getSchemaReference() != null)) {
if (descriptor.hasInheritance()) {
XMLField indicatorField = (XMLField) descriptor.getInheritancePolicy().getClassIndicatorField();
if ((indicatorField.getLastXPathFragment().getNamespaceURI() != null) && indicatorField.getLastXPathFragment().getNamespaceURI().equals(XMLConstants.SCHEMA_INSTANCE_URL)
&& indicatorField.getLastXPathFragment().getLocalName().equals(XMLConstants.SCHEMA_TYPE_ATTRIBUTE)) {
return false;
}
}
XMLSchemaReference xmlRef = xmlDescriptor.getSchemaReference();
if ((xmlRef.getType() == XMLSchemaReference.COMPLEX_TYPE) && xmlRef.isGlobalDefinition()) {
QName ctxQName = xmlRef.getSchemaContextAsQName(xmlDescriptor.getNamespaceResolver());
QName leafType = ((XMLField) getField()).getLeafElementType();
if ((leafType == null) || (!ctxQName.equals(record.getLeafElementType()))) {
return true;
}
}
}
return false;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
protected ClassDescriptor buildSelectedFieldsLockingPolicyDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(SelectedFieldsLockingPolicy.class);
descriptor.getInheritancePolicy().setParentClass(OptimisticLockingPolicy.class);
XMLCompositeCollectionMapping fieldsMapping = new XMLCompositeCollectionMapping();
fieldsMapping.useCollectionClass(NonSynchronizedVector.class);
fieldsMapping.setAttributeName("lockFields");
fieldsMapping.setXPath(getPrimaryNamespaceXPath() + "fields/" + getPrimaryNamespaceXPath() + "field");
fieldsMapping.setReferenceClass(DatabaseField.class);
((XMLField)fieldsMapping.getField()).setLeafElementType(fieldQname);
descriptor.addMapping(fieldsMapping);
return descriptor;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
protected ClassDescriptor buildSelectedFieldsLockingPolicyDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(SelectedFieldsLockingPolicy.class);
descriptor.getInheritancePolicy().setParentClass(OptimisticLockingPolicy.class);
XMLCompositeCollectionMapping fieldsMapping = new XMLCompositeCollectionMapping();
fieldsMapping.useCollectionClass(NonSynchronizedVector.class);
fieldsMapping.setAttributeName("lockFields");
fieldsMapping.setXPath(getPrimaryNamespaceXPath() + "fields/" + getPrimaryNamespaceXPath() + "field");
fieldsMapping.setReferenceClass(DatabaseField.class);
((XMLField)fieldsMapping.getField()).setLeafElementType(fieldQname);
descriptor.addMapping(fieldsMapping);
return descriptor;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.sdo
private DatabaseMapping buildXMLCompositeCollectionMapping(String mappingUri) {
XMLCompositeCollectionMapping mapping = new XMLCompositeCollectionMapping();
mapping.setAttributeName(getName());
String xpath = getQualifiedXPath(mappingUri, false);
mapping.setXPath(xpath);
if (!getType().isDataObjectType()) {
QName schemaContext = getType().getXmlDescriptor().getSchemaReference().getSchemaContextAsQName(getType().getXmlDescriptor().getNamespaceResolver());
((XMLField)mapping.getField()).setLeafElementType(schemaContext);
mapping.setReferenceClassName(getType().getImplClassName());
mapping.setReferenceClass(getType().getImplClass());
}else{
if(getXsdType()!= null){
((XMLField)mapping.getField()).setLeafElementType(getXsdType());
}
}
mapping.useCollectionClass(ListWrapper.class);
// Set null policy on mapping for xsi:nil support:
// - aNullPolicy.setNullRepresentedByEmptyNode(false);
// - aNullPolicy.setNullRepresentedByXsiNil(true);
setIsSetNillablePolicyOnMapping(mapping, propertyName);
return mapping;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
private DatabaseMapping buildXMLCompositeCollectionMapping(String mappingUri) {
XMLCompositeCollectionMapping mapping = new XMLCompositeCollectionMapping();
mapping.setAttributeName(getName());
String xpath = getQualifiedXPath(mappingUri, false);
mapping.setXPath(xpath);
if (!getType().isDataObjectType()) {
QName schemaContext = getType().getXmlDescriptor().getSchemaReference().getSchemaContextAsQName(getType().getXmlDescriptor().getNamespaceResolver());
((XMLField)mapping.getField()).setLeafElementType(schemaContext);
mapping.setReferenceClassName(getType().getImplClassName());
mapping.setReferenceClass(getType().getImplClass());
}else{
if(getXsdType()!= null){
((XMLField)mapping.getField()).setLeafElementType(getXsdType());
}
}
mapping.useCollectionClass(ListWrapper.class);
// Set null policy on mapping for xsi:nil support:
// - aNullPolicy.setNullRepresentedByEmptyNode(false);
// - aNullPolicy.setNullRepresentedByXsiNil(true);
setIsSetNillablePolicyOnMapping(mapping, propertyName);
return mapping;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
protected ClassDescriptor buildObjectRelationalDataTypeDescriptorDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(ObjectRelationalDataTypeDescriptor.class);
descriptor.getInheritancePolicy().setParentClass(RelationalDescriptor.class);
XMLDirectMapping structureMapping = new XMLDirectMapping();
structureMapping.setAttributeName("structureName");
structureMapping.setGetMethodName("getStructureName");
structureMapping.setSetMethodName("setStructureName");
structureMapping.setXPath(getPrimaryNamespaceXPath() + "structure/text()");
descriptor.addMapping(structureMapping);
XMLCompositeCollectionMapping orderedFieldsMapping = new XMLCompositeCollectionMapping();
orderedFieldsMapping.useCollectionClass(NonSynchronizedVector.class);
orderedFieldsMapping.setAttributeName("orderedFields");
orderedFieldsMapping.setXPath(getPrimaryNamespaceXPath() + "field-order/" + getPrimaryNamespaceXPath() + "field");
orderedFieldsMapping.setReferenceClass(DatabaseField.class);
((XMLField)orderedFieldsMapping.getField()).setLeafElementType(fieldQname);
descriptor.addMapping(orderedFieldsMapping);
return descriptor;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
protected ClassDescriptor buildObjectRelationalDataTypeDescriptorDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(ObjectRelationalDataTypeDescriptor.class);
descriptor.getInheritancePolicy().setParentClass(RelationalDescriptor.class);
XMLDirectMapping structureMapping = new XMLDirectMapping();
structureMapping.setAttributeName("structureName");
structureMapping.setGetMethodName("getStructureName");
structureMapping.setSetMethodName("setStructureName");
structureMapping.setXPath(getPrimaryNamespaceXPath() + "structure/text()");
descriptor.addMapping(structureMapping);
XMLCompositeCollectionMapping orderedFieldsMapping = new XMLCompositeCollectionMapping();
orderedFieldsMapping.useCollectionClass(NonSynchronizedVector.class);
orderedFieldsMapping.setAttributeName("orderedFields");
orderedFieldsMapping.setXPath(getPrimaryNamespaceXPath() + "field-order/" + getPrimaryNamespaceXPath() + "field");
orderedFieldsMapping.setReferenceClass(DatabaseField.class);
((XMLField)orderedFieldsMapping.getField()).setLeafElementType(fieldQname);
descriptor.addMapping(orderedFieldsMapping);
return descriptor;
}
内容来源于网络,如有侵权,请联系作者删除!