org.exolab.castor.mapping.Mapping.getClassLoader()方法的使用及代码示例

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

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

Mapping.getClassLoader介绍

[英]Returns the class loader used by this mapping object. The returned class loaded may be the one passed in the constructor, the one used to load Castor, or in some 1.1 JVMs null.
[中]返回此映射对象使用的类加载器。加载的返回类可能是在构造函数中传递的类、用于加载Castor的类,或者在某些1.1 JVM中为null。

代码示例

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

/**
 * Creates a new Unmarshaller with the given Mapping.
 *
 * @param internalContext the internal context to use
 * @param mapping The Mapping to use.
 * @throws MappingException in case that Unmarshaller fails to be instantiated
 *
 * @throws IllegalArgumentException if internalContext is null
 */
public Unmarshaller(final InternalContext internalContext, final Mapping mapping)
  throws MappingException {
 this(internalContext, null, null);
 if (mapping != null) {
  setMapping(mapping);
  this._loader = mapping.getClassLoader();
 }
}

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

/**
 * Creates a new Unmarshaller with the given Mapping.
 *
 * @param internalContext the internal context to use
 * @param mapping The Mapping to use.
 * @throws MappingException in case that Unmarshaller fails to be instantiated 
 */
public Unmarshaller(final InternalContext internalContext, final Mapping mapping)
throws MappingException {
  this(internalContext, null, null);
  if (mapping != null) {
    setMapping(mapping);
    this._loader = mapping.getClassLoader();
  }
}

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

/**
 * Sets the Mapping to use during unmarshalling. If the Mapping has a ClassLoader it will be used
 * during unmarshalling.
 *
 * @param mapping Mapping to use during unmarshalling.
 * @see #setResolver
 */
public void setMapping(final Mapping mapping) throws MappingException {
 if (_loader == null) {
  _loader = mapping.getClassLoader();
 }
 MappingUnmarshaller mum = new MappingUnmarshaller();
 MappingLoader resolver = mum.getMappingLoader(mapping, BindingType.XML);
 _internalContext.getXMLClassDescriptorResolver().setMappingLoader(resolver);
}

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

/**
 * Sets the Mapping to use during unmarshalling. If the Mapping has a ClassLoader it
 * will be used during unmarshalling.
 *
 * @param mapping Mapping to use during unmarshalling.
 * @see #setResolver
 */
public void setMapping(final Mapping mapping) throws MappingException {
  if (_loader == null) {
    _loader = mapping.getClassLoader();
  }
  
  MappingUnmarshaller mum = new MappingUnmarshaller();
  MappingLoader resolver = mum.getMappingLoader(mapping, BindingType.XML);
  _internalContext.getXMLClassDescriptorResolver().setMappingLoader(resolver);
}

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

loader = (AbstractMappingLoader) _registry.getMappingLoader(
    "CastorXmlMapping", bindingType);
loader.setClassLoader(mapping.getClassLoader());
loader.setAllowRedefinitions(_allowRedefinitions);
loader.setInternalContext(_internalContext);

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

/**
 * Returns a mapping resolver for the suitable engine. The engine's specific mapping loader is
 * created and used to create engine specific descriptors, returning a suitable mapping resolver.
 * The mapping resolver is cached in memory and returned in subsequent method calls.
 *
 * @param mapping The mapping to load and resolve.
 * @param bindingType The binding type to read from mapping.
 * @param param Arbitrary parameter that is to be passed to resolver.loadMapping().
 * @return A mapping resolver
 * @throws MappingException A mapping error occured preventing descriptors from being generated
 *         from the loaded mapping.
 */
public MappingLoader getMappingLoader(final Mapping mapping, final BindingType bindingType,
  final Object param) throws MappingException {
 synchronized (this) {
  Iterator iter = mapping.getMappingSources().iterator();
  while (iter.hasNext()) {
   MappingSource source = (MappingSource) iter.next();
   loadMappingInternal(mapping, source.getResolver(), source.getSource());
  }
  AbstractMappingLoader loader;
  loader = (AbstractMappingLoader) _registry.getMappingLoader("CastorXmlMapping", bindingType);
  loader.setClassLoader(mapping.getClassLoader());
  loader.setAllowRedefinitions(_allowRedefinitions);
  loader.setInternalContext(_internalContext);
  loader.loadMapping(mapping.getRoot(), param);
  return loader;
 }
}

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

ClassLoader loader = mapping.getClassLoader();
  factory = new DataSourceConnectionFactory(choice.getDataSource(), useProxies, loader);
} else if (choice.getJndi() != null) {

相关文章