本文整理了Java中org.exolab.castor.xml.Marshaller.getResolver()
方法的一些代码示例,展示了Marshaller.getResolver()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Marshaller.getResolver()
方法的具体详情如下:
包路径:org.exolab.castor.xml.Marshaller
类名称:Marshaller
方法名:getResolver
[英]Returns the ClassDescriptorResolver for use during marshalling
[中]返回在编组期间使用的ClassDescriptorResolver
代码示例来源:origin: org.codehaus.castor/castor-xml
/**
* Finds and returns an XMLClassDescriptor for the given class. If a XMLClassDescriptor could not
* be found, this method will attempt to create one automatically using reflection.
*
* @param cls the Class to get the XMLClassDescriptor for
* @exception MarshalException when there is a problem retrieving or creating the
* XMLClassDescriptor for the given class
**/
private XMLClassDescriptor getClassDescriptor(final Class<?> cls) throws MarshalException {
XMLClassDescriptor classDesc = null;
try {
if (!isPrimitive(cls))
classDesc = (XMLClassDescriptor) getResolver().resolve(cls);
} catch (ResolverException rx) {
Throwable actual = rx.getCause();
if (actual instanceof MarshalException) {
throw (MarshalException) actual;
}
if (actual != null) {
throw new MarshalException(actual);
}
throw new MarshalException(rx);
}
if (classDesc != null)
classDesc = new InternalXMLClassDescriptor(classDesc);
return classDesc;
} // -- getClassDescriptor
代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor
/**
* Finds and returns an XMLClassDescriptor for the given class. If
* a XMLClassDescriptor could not be found, this method will attempt to
* create one automatically using reflection.
* @param _class the Class to get the XMLClassDescriptor for
* @exception MarshalException when there is a problem
* retrieving or creating the XMLClassDescriptor for the given class
**/
private XMLClassDescriptor getClassDescriptor(Class _class)
throws MarshalException
{
XMLClassDescriptor classDesc = null;
try {
if (!isPrimitive(_class))
classDesc = (XMLClassDescriptor) getResolver().resolve(_class);
}
catch(ResolverException rx) {
Throwable actual = rx.getCause();
if (actual instanceof MarshalException) {
throw (MarshalException)actual;
}
if (actual != null) {
throw new MarshalException(actual);
}
throw new MarshalException(rx);
}
if (classDesc != null)
classDesc = new InternalXMLClassDescriptor(classDesc);
return classDesc;
} //-- getClassDescriptor
代码示例来源:origin: org.codehaus.castor/castor-xml
XMLClassDescriptor tmpDesc = null;
try {
tmpDesc = getResolver().resolveByXMLName(name, nsURI, null);
} catch (ResolverException rx) {
XMLMappingLoader ml = (XMLMappingLoader) getResolver().getMappingLoader();
if (ml != null) {
containsDesc = (ml.getDescriptor(cls.getName()) != null);
xmlElementNameClassDesc = getResolver().resolveByXMLName(xmlElementName, null, null);
} catch (ResolverException rx) {
getResolver().resolveAllByXMLName(xmlElementName, null, null);
for (; classDescriptorIter.hasNext();) {
xmlElementNameClassDesc = (XMLClassDescriptor) classDescriptorIter.next();
代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor
XMLClassDescriptor tmpDesc = null;
try {
tmpDesc = getResolver().resolveByXMLName(name, nsURI, null);
XMLMappingLoader ml = (XMLMappingLoader) getResolver().getMappingLoader();
if (ml != null) {
containsDesc = (ml.getDescriptor(_class.getName()) != null);
xmlElementNameClassDesc = getResolver().resolveByXMLName(xmlElementName, null, null);
Iterator classDescriptorIter = getResolver().resolveAllByXMLName(xmlElementName, null, null);
for (; classDescriptorIter.hasNext();) {
xmlElementNameClassDesc = (XMLClassDescriptor) classDescriptorIter.next();
内容来源于网络,如有侵权,请联系作者删除!