- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping.getField()
方法的一些代码示例,展示了XMLCompositeDirectCollectionMapping.getField()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLCompositeDirectCollectionMapping.getField()
方法的具体详情如下:
包路径:org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping
类名称:XMLCompositeDirectCollectionMapping
方法名:getField
暂无
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
public Object convertObjectValueToDataValue(Object objectValue, Session session) {
return this.conversionManager.convertListToString(objectValue, ((Field)mapping.getField()).getSchemaType());
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
public Object convertObjectValueToDataValue(Object objectValue, Session session) {
return this.conversionManager.convertListToString(objectValue, ((Field)mapping.getField()).getSchemaType());
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
public void writeSingleValue(Object value, Object parent, XMLRecord record, AbstractSession session) {
Object element = convertObjectValueToDataValue(value, session, record.getMarshaller());
record.add(this.getField(), element);
}
代码示例来源: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());
record.add(this.getField(), element);
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
public Object convertDataValueToObjectValue(Object dataValue, Session session) {
return this.conversionManager.convertStringToList(dataValue, getObjectClass(), mapping.getContainerPolicy(), ((Field)mapping.getField()).getSchemaType());
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
public Object convertDataValueToObjectValue(Object dataValue, Session session) {
return this.conversionManager.convertStringToList(dataValue, getObjectClass(), mapping.getContainerPolicy(), ((Field)mapping.getField()).getSchemaType());
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* INTERNAL:
* Initialize the mapping.
*/
public void initialize(AbstractSession session) throws DescriptorException {
super.initialize(session);
if (this.getField() instanceof XMLField) {
if (valueConverter instanceof TypeConversionConverter) {
TypeConversionConverter converter = (TypeConversionConverter) valueConverter;
this.getField().setType(converter.getObjectClass());
}
String xpathString = ((XMLField) getField()).getXPath();
if (this.isAbstractCompositeDirectCollectionMapping() && (xpathString.indexOf(XMLConstants.ATTRIBUTE) == -1) && (!xpathString.endsWith(XMLConstants.TEXT))) {
throw DescriptorException.invalidXpathForXMLDirectMapping(this);
}
}
ContainerPolicy cp = getContainerPolicy();
if (cp != null) {
if (cp.getContainerClass() == null) {
Class cls = session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(cp.getContainerClassName());
cp.setContainerClass(cls);
}
}
((XMLField) this.getField()).setIsCDATA(this.isCDATA());
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* INTERNAL:
* Initialize the mapping.
*/
public void initialize(AbstractSession session) throws DescriptorException {
super.initialize(session);
if (this.getField() instanceof XMLField) {
if (valueConverter instanceof TypeConversionConverter) {
TypeConversionConverter converter = (TypeConversionConverter) valueConverter;
this.getField().setType(converter.getObjectClass());
}
String xpathString = ((XMLField) getField()).getXPath();
if (this.isAbstractCompositeDirectCollectionMapping() && (xpathString.indexOf(XMLConstants.ATTRIBUTE) == -1) && (!xpathString.endsWith(XMLConstants.TEXT))) {
throw DescriptorException.invalidXpathForXMLDirectMapping(this);
}
}
ContainerPolicy cp = getContainerPolicy();
if (cp != null) {
if (cp.getContainerClass() == null) {
Class cls = session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(cp.getContainerClassName());
cp.setContainerClass(cls);
}
}
((XMLField) this.getField()).setIsCDATA(this.isCDATA());
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Initialize the mapping.
*/
public void initialize(AbstractSession session) throws DescriptorException {
super.initialize(session);
if (this.getField() instanceof XMLField && getValueConverter() instanceof TypeConversionConverter) {
TypeConversionConverter converter = (TypeConversionConverter) getValueConverter();
this.getField().setType(converter.getObjectClass());
}
ContainerPolicy cp = getContainerPolicy();
if (cp != null) {
if (cp.getContainerClass() == null) {
Class cls = session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(cp.getContainerClassName());
cp.setContainerClass(cls);
}
}
((XMLField) this.getField()).setIsCDATA(this.isCDATA());
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
public void endElement(XPathFragment xPathFragment, UnmarshalRecord unmarshalRecord) {
XMLField xmlField = (XMLField) xmlCompositeDirectCollectionMapping.getField();
if (!xmlField.getLastXPathFragment().nameIsText()) {
return;
}
Object value = unmarshalRecord.getStringBuffer().toString();
Object collection = unmarshalRecord.getContainerInstance(this);
unmarshalRecord.resetStringBuffer();
if (xmlCompositeDirectCollectionMapping.usesSingleNode()) {
StringTokenizer stringTokenizer = new StringTokenizer((String) value);
while (stringTokenizer.hasMoreTokens()) {
addUnmarshalValue(unmarshalRecord, stringTokenizer.nextToken(), collection);
}
} else {
if (value.equals(XMLConstants.EMPTY_STRING)) {
if (xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByEmptyNode() ||
xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByXsiNil()) {
return;
}
}
addUnmarshalValue(unmarshalRecord, value, collection);
}
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
public void writeSingleValue(Object value, Object parent, XMLRecord record, AbstractSession session) {
Object element = value;
if (hasValueConverter()) {
if (getValueConverter() instanceof XMLConverter) {
element = ((XMLConverter) getValueConverter()).convertObjectValueToDataValue(element, session, record.getMarshaller());
} else {
element = getValueConverter().convertObjectValueToDataValue(element, session);
}
}
record.add(this.getField(), element);
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
public boolean startElement(XPathFragment xPathFragment, UnmarshalRecord unmarshalRecord, Attributes atts) {
XMLField xmlField = (XMLField) xmlCompositeDirectCollectionMapping.getField();
if (xmlField.getLastXPathFragment().nameIsText()) {
String type = atts.getValue(XMLConstants.SCHEMA_INSTANCE_URL, XMLConstants.SCHEMA_TYPE_ATTRIBUTE);
if (null != type) {
String namespaceURI = null;
int colonIndex = type.indexOf(XMLConstants.COLON);
if (colonIndex > -1) {
String prefix = type.substring(0, colonIndex);
namespaceURI = unmarshalRecord.resolveNamespacePrefix(prefix);
type = type.substring(colonIndex + 1);
}
unmarshalRecord.setTypeQName(new QName(namespaceURI, type));
}
if (xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByXsiNil() && xmlCompositeDirectCollectionMapping.getNullPolicy().valueIsNull(atts)) {
getContainerPolicy().addInto(null, unmarshalRecord.getContainerInstance(this), unmarshalRecord.getSession());
}
} else if (xmlField.getLastXPathFragment().isAttribute()) {
if (!this.xmlCompositeDirectCollectionMapping.usesSingleNode()) {
String namespaceURI = xmlField.getLastXPathFragment().getNamespaceURI();
if (namespaceURI == null) {
namespaceURI = XMLConstants.EMPTY_STRING;
}
String value = atts.getValue(namespaceURI, xmlField.getLastXPathFragment().getLocalName());
Object collection = unmarshalRecord.getContainerInstance(this);
addUnmarshalValue(unmarshalRecord, value, collection);
}
}
return true;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
private XMLDescriptor buildAnnotationDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Annotation.class);
descriptor.setNamespaceResolver(namespaceResolver);
XMLCompositeDirectCollectionMapping documentationMapping = new XMLCompositeDirectCollectionMapping();
documentationMapping.setAttributeName("documentation");
documentationMapping.useCollectionClass(ArrayList.class);
documentationMapping.setXPath(Constants.SCHEMA_PREFIX + ":" + "documentation");
((XMLField)documentationMapping.getField()).setUsesSingleNode(false);
descriptor.addMapping(documentationMapping);
XMLFragmentCollectionMapping appInfoMapping = new XMLFragmentCollectionMapping();
appInfoMapping.setAttributeName("appInfo");
appInfoMapping.setXPath(Constants.SCHEMA_PREFIX + ":" + "appinfo");
appInfoMapping.useCollectionClass(java.util.ArrayList.class);
descriptor.addMapping(appInfoMapping);
return descriptor;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
private XMLDescriptor buildAnnotationDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Annotation.class);
descriptor.setNamespaceResolver(namespaceResolver);
XMLCompositeDirectCollectionMapping documentationMapping = new XMLCompositeDirectCollectionMapping();
documentationMapping.setAttributeName("documentation");
documentationMapping.useCollectionClass(ArrayList.class);
documentationMapping.setXPath(Constants.SCHEMA_PREFIX + ":" + "documentation");
((XMLField)documentationMapping.getField()).setUsesSingleNode(false);
descriptor.addMapping(documentationMapping);
XMLFragmentCollectionMapping appInfoMapping = new XMLFragmentCollectionMapping();
appInfoMapping.setAttributeName("appInfo");
appInfoMapping.setXPath(Constants.SCHEMA_PREFIX + ":" + "appinfo");
appInfoMapping.useCollectionClass(java.util.ArrayList.class);
descriptor.addMapping(appInfoMapping);
return descriptor;
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
private XMLDescriptor buildAnnotationDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Annotation.class);
descriptor.setNamespaceResolver(namespaceResolver);
XMLCompositeDirectCollectionMapping documentationMapping = new XMLCompositeDirectCollectionMapping();
documentationMapping.setAttributeName("documentation");
documentationMapping.useCollectionClass(ArrayList.class);
documentationMapping.setXPath(XMLConstants.SCHEMA_PREFIX + ":" + "documentation");
((XMLField)documentationMapping.getField()).setUsesSingleNode(false);
descriptor.addMapping(documentationMapping);
XMLFragmentCollectionMapping appInfoMapping = new XMLFragmentCollectionMapping();
appInfoMapping.setAttributeName("appInfo");
appInfoMapping.setXPath(XMLConstants.SCHEMA_PREFIX + ":" + "appinfo");
appInfoMapping.useCollectionClass(java.util.ArrayList.class);
descriptor.addMapping(appInfoMapping);
return descriptor;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
public SDOChangeSummaryType(SDOTypeHelper sdoTypeHelper) {
super(SDOConstants.SDO_URL, SDOConstants.CHANGESUMMARY, sdoTypeHelper);
setInstanceClass(ChangeSummary.class);
xmlDescriptor.setJavaClass(SDOChangeSummary.class);
xmlDescriptor.setSequencedObject(false);
XMLDirectMapping loggingMapping = new XMLDirectMapping();
loggingMapping.setAttributeName("loggingMapping");
loggingMapping.setXPath("@logging");
loggingMapping.setNullValue(Boolean.TRUE);
xmlDescriptor.addMapping(loggingMapping);
XMLCompositeDirectCollectionMapping createdMapping = new XMLCompositeDirectCollectionMapping();
createdMapping.setAttributeName("createdXPaths");
createdMapping.setXPath("@create");
createdMapping.useCollectionClass(ArrayList.class);
((XMLField)createdMapping.getField()).setUsesSingleNode(true);
xmlDescriptor.addMapping(createdMapping);
XMLCompositeDirectCollectionMapping deletedMapping = new XMLCompositeDirectCollectionMapping();
deletedMapping.setAttributeName("deletedXPaths");
deletedMapping.setXPath("@delete");
deletedMapping.useCollectionClass(ArrayList.class);
((XMLField)deletedMapping.getField()).setUsesSingleNode(true);
xmlDescriptor.addMapping(deletedMapping);
XMLAnyCollectionMapping aChangeMapping = new XMLAnyCollectionMapping();
aChangeMapping.setAttributeName("modifiedDoms");
aChangeMapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT);
aChangeMapping.useCollectionClass(ArrayList.class);
xmlDescriptor.addMapping(aChangeMapping);
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
private DatabaseMapping buildXMLCompositeDirectCollectionMapping(String mappingUri) {
XMLCompositeDirectCollectionMapping mapping = new XMLCompositeDirectCollectionMapping();
mapping.setAttributeName(getName());
String xpath = getQualifiedXPath(mappingUri, true);
mapping.setXPath(xpath);
mapping.setAttributeElementClass(getType().getInstanceClass());
if (getXsdType() != null) {
((XMLField)mapping.getField()).setSchemaType(getXsdType());
}
if (getType().equals(SDOConstants.SDO_STRINGS)) {
mapping.setUsesSingleNode(true);
}
if (getType().getInstanceClass() != null) {
if (shouldAddInstanceClassConverter()) {
InstanceClassConverter converter = new InstanceClassConverter();
converter.setCustomClass(getType().getInstanceClass());
mapping.setValueConverter(converter);
}
}
return mapping;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.sdo
private DatabaseMapping buildXMLCompositeDirectCollectionMapping(String mappingUri) {
XMLCompositeDirectCollectionMapping mapping = new XMLCompositeDirectCollectionMapping();
mapping.setAttributeName(getName());
String xpath = getQualifiedXPath(mappingUri, true);
mapping.setXPath(xpath);
mapping.setAttributeElementClass(getType().getInstanceClass());
if (getXsdType() != null) {
((XMLField)mapping.getField()).setSchemaType(getXsdType());
}
if (getType().equals(SDOConstants.SDO_STRINGS)) {
mapping.setUsesSingleNode(true);
}
if (getType().getInstanceClass() != null) {
if (shouldAddInstanceClassConverter()) {
InstanceClassConverter converter = new InstanceClassConverter();
converter.setCustomClass(getType().getInstanceClass());
mapping.setValueConverter(converter);
}
}
return mapping;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.sdo
public SDOChangeSummaryType(SDOTypeHelper sdoTypeHelper) {
super(SDOConstants.SDO_URL, SDOConstants.CHANGESUMMARY, sdoTypeHelper);
setInstanceClass(ChangeSummary.class);
xmlDescriptor.setJavaClass(SDOChangeSummary.class);
xmlDescriptor.setSequencedObject(false);
XMLDirectMapping loggingMapping = new XMLDirectMapping();
loggingMapping.setAttributeName("loggingMapping");
loggingMapping.setXPath("@logging");
loggingMapping.setNullValue(Boolean.TRUE);
xmlDescriptor.addMapping(loggingMapping);
XMLCompositeDirectCollectionMapping createdMapping = new XMLCompositeDirectCollectionMapping();
createdMapping.setAttributeName("createdXPaths");
createdMapping.setXPath("@create");
createdMapping.useCollectionClass(ArrayList.class);
((XMLField)createdMapping.getField()).setUsesSingleNode(true);
xmlDescriptor.addMapping(createdMapping);
XMLCompositeDirectCollectionMapping deletedMapping = new XMLCompositeDirectCollectionMapping();
deletedMapping.setAttributeName("deletedXPaths");
deletedMapping.setXPath("@delete");
deletedMapping.useCollectionClass(ArrayList.class);
((XMLField)deletedMapping.getField()).setUsesSingleNode(true);
xmlDescriptor.addMapping(deletedMapping);
XMLAnyCollectionMapping aChangeMapping = new XMLAnyCollectionMapping();
aChangeMapping.setAttributeName("modifiedDoms");
aChangeMapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT);
aChangeMapping.useCollectionClass(ArrayList.class);
xmlDescriptor.addMapping(aChangeMapping);
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
private void addUnmarshalValue(UnmarshalRecord unmarshalRecord, Object value, Object collection) {
if (null == value) {
return;
}
if (xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByXsiNil() && xmlCompositeDirectCollectionMapping.getNullPolicy().valueIsNull(unmarshalRecord.getAttributes())) {
return;
}
if ((!isWhitespaceAware() && XMLConstants.EMPTY_STRING.equals(value))) {
return;
}
XMLField xmlField = (XMLField) xmlCompositeDirectCollectionMapping.getField();
XMLConversionManager xmlConversionManager = (XMLConversionManager) unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager();
if (unmarshalRecord.getTypeQName() != null) {
Class typeClass = xmlField.getJavaClass(unmarshalRecord.getTypeQName());
value = xmlConversionManager.convertObject(value, typeClass, unmarshalRecord.getTypeQName());
} else {
value = xmlField.convertValueBasedOnSchemaType(value, xmlConversionManager, unmarshalRecord);
}
if (xmlCompositeDirectCollectionMapping.hasValueConverter()) {
if (xmlCompositeDirectCollectionMapping.getValueConverter() instanceof XMLConverter) {
value = ((XMLConverter) xmlCompositeDirectCollectionMapping.getValueConverter()).convertDataValueToObjectValue(value, unmarshalRecord.getSession(), unmarshalRecord.getUnmarshaller());
} else {
value = xmlCompositeDirectCollectionMapping.getValueConverter().convertDataValueToObjectValue(value, unmarshalRecord.getSession());
}
}
unmarshalRecord.addAttributeValue(this, value, collection);
}
对于我的应用程序,我需要能够找到类型(不是实例)的字段列表以及运行时这些字段的类型。到目前为止,我只能获得一个包含classOf[MyCaseClass].getMethods的getter的case
我正在尝试在个人资料页面上显示用户行中的点。我尝试使用以下内容 getField('points');?> 拉出包含用户点的字段,但没有为我正在测试的用户显示任何内容。我正在测试它,以设置了 16 点
问题:我希望用户输入一种颜色(红色、蓝色)并将其转换为与颜色一起使用 我一直在看这个 Getting a Color from a String input ,我知道最好使用 JColorChoose
谁能看出我在下面做错了什么?该类型具有服务方法试图访问的公共(public)属性,那么为什么它没有被反射拾取? Public class SomeClass { private YetAnoth
我正在尝试 getField 但总是返回 null这是代码的图像和变量的监视。 代码:FieldInfo xSortField = xFieldInfo.GetValue(x).GetType().G
我试图反射(reflect)派生类型中的字段,但它返回的字段基本类型。 public class basetype { string basevar; } public class deriv
我目前正在尝试将 Xamarin.iOS 应用程序库转换为 PCL。我有这段无法编译的代码: private void SetPrivateField(object item, string
我希望能够为用户定义的类型创建一个调度,该类型本质上将进行就地复制。但是,我想以一种类型稳定的方式来做,因此我想避免使用 getfield直接,而是尝试使用生成的函数。像这样的类型是否可能 type
我注意到在调用 GetFields() 时在枚举类型上,我得到了一个 int32 类型的额外字段。它从哪里来的?? 当我调用另一个重载 (GetFields(System.Reflection.Bin
我试图了解 Mirrors Api 的工作原理。具体来说,如何从它的Symbol中获取一个字段的值, 使用 getField . 对于getField方法,它应该适用于任何 Symbol这是一个 se
我有一个示例类: public class A { public int x; } 如果我要做如下的事情: Class a = Class.forName("A"); for (Field f
如果我通过 Assembly.Load 加载程序集,我可以迭代其类型,通过 typef(...).IsAssignableFrom 查找特定类型,并通过 GetField 从类型中获取字段信息。 当我
public string[] tName = new string[]{"Whatever","Doesntmatter"}; string vBob = "Something"; string[]
我已将 720 张新图像添加到我的 Drawable 文件夹中,但是当我使用 Field[] drawables = android.R.drawable.class.getFields() 时,没有
在我目前正在处理的项目中,我偶然发现了这个问题: 我想创建类“ApiID”的实例。我从 Reflector 获得了代码,如您所见,.dll(不是我的项目)导入来自非托管代码,我无权访问。 [S
Class.getFields() 的 Javadoc 说:“返回的数组中的元素未排序且未按任何特定顺序排列。” 关于订单实际如何确定的任何提示?有没有可能当我两次执行这个方法时,我得到的字段顺序不同
这段旧代码在使用反射的方法调用中返回一个用属性修饰的字段列表 有没有办法用 TypeDescripter 或 LINQ 替换它? public static FieldInfo[] GetFi
我正在尝试检索对象的公共(public)属性,但它没有返回任何内容。你能告诉我我做错了什么吗? public class AdHocCallReportViewModel : ReportViewMo
我正在尝试实现一个位于 https://github.com/jbogard/presentations/blob/master/WickedDomainModels/After/Model/Enum
C#,网络 2.0 这是代码(我取出了所有特定于域的内容,它仍然返回一个空数组): using System; using System.Collections.Generic; using Syst
我是一名优秀的程序员,十分优秀!