org.exolab.castor.xml.Marshaller.getResolver()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(215)

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

Marshaller.getResolver介绍

[英]Returns the ClassDescriptorResolver for use during marshalling
[中]返回在编组期间使用的ClassDescriptorResolver

代码示例

代码示例来源:origin: org.codehaus.castor/castor-xml

  1. /**
  2. * Finds and returns an XMLClassDescriptor for the given class. If a XMLClassDescriptor could not
  3. * be found, this method will attempt to create one automatically using reflection.
  4. *
  5. * @param cls the Class to get the XMLClassDescriptor for
  6. * @exception MarshalException when there is a problem retrieving or creating the
  7. * XMLClassDescriptor for the given class
  8. **/
  9. private XMLClassDescriptor getClassDescriptor(final Class<?> cls) throws MarshalException {
  10. XMLClassDescriptor classDesc = null;
  11. try {
  12. if (!isPrimitive(cls))
  13. classDesc = (XMLClassDescriptor) getResolver().resolve(cls);
  14. } catch (ResolverException rx) {
  15. Throwable actual = rx.getCause();
  16. if (actual instanceof MarshalException) {
  17. throw (MarshalException) actual;
  18. }
  19. if (actual != null) {
  20. throw new MarshalException(actual);
  21. }
  22. throw new MarshalException(rx);
  23. }
  24. if (classDesc != null)
  25. classDesc = new InternalXMLClassDescriptor(classDesc);
  26. return classDesc;
  27. } // -- getClassDescriptor

代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor

  1. /**
  2. * Finds and returns an XMLClassDescriptor for the given class. If
  3. * a XMLClassDescriptor could not be found, this method will attempt to
  4. * create one automatically using reflection.
  5. * @param _class the Class to get the XMLClassDescriptor for
  6. * @exception MarshalException when there is a problem
  7. * retrieving or creating the XMLClassDescriptor for the given class
  8. **/
  9. private XMLClassDescriptor getClassDescriptor(Class _class)
  10. throws MarshalException
  11. {
  12. XMLClassDescriptor classDesc = null;
  13. try {
  14. if (!isPrimitive(_class))
  15. classDesc = (XMLClassDescriptor) getResolver().resolve(_class);
  16. }
  17. catch(ResolverException rx) {
  18. Throwable actual = rx.getCause();
  19. if (actual instanceof MarshalException) {
  20. throw (MarshalException)actual;
  21. }
  22. if (actual != null) {
  23. throw new MarshalException(actual);
  24. }
  25. throw new MarshalException(rx);
  26. }
  27. if (classDesc != null)
  28. classDesc = new InternalXMLClassDescriptor(classDesc);
  29. return classDesc;
  30. } //-- getClassDescriptor

代码示例来源:origin: org.codehaus.castor/castor-xml

  1. XMLClassDescriptor tmpDesc = null;
  2. try {
  3. tmpDesc = getResolver().resolveByXMLName(name, nsURI, null);
  4. } catch (ResolverException rx) {
  5. XMLMappingLoader ml = (XMLMappingLoader) getResolver().getMappingLoader();
  6. if (ml != null) {
  7. containsDesc = (ml.getDescriptor(cls.getName()) != null);
  8. xmlElementNameClassDesc = getResolver().resolveByXMLName(xmlElementName, null, null);
  9. } catch (ResolverException rx) {
  10. getResolver().resolveAllByXMLName(xmlElementName, null, null);
  11. for (; classDescriptorIter.hasNext();) {
  12. xmlElementNameClassDesc = (XMLClassDescriptor) classDescriptorIter.next();

代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor

  1. XMLClassDescriptor tmpDesc = null;
  2. try {
  3. tmpDesc = getResolver().resolveByXMLName(name, nsURI, null);
  4. XMLMappingLoader ml = (XMLMappingLoader) getResolver().getMappingLoader();
  5. if (ml != null) {
  6. containsDesc = (ml.getDescriptor(_class.getName()) != null);
  7. xmlElementNameClassDesc = getResolver().resolveByXMLName(xmlElementName, null, null);
  8. Iterator classDescriptorIter = getResolver().resolveAllByXMLName(xmlElementName, null, null);
  9. for (; classDescriptorIter.hasNext();) {
  10. xmlElementNameClassDesc = (XMLClassDescriptor) classDescriptorIter.next();

相关文章