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

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

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

Mapping.<init>介绍

[英]Constructs a new mapping.
[中]构建一个新的映射。

代码示例

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

/**
 * Creates an instance of a Castor XML specific {@link Mapping} instance.
 * 
 * @return a Castor XML specific {@link Mapping} instance.
 */
public Mapping createMapping() {
 Mapping mapping = new Mapping();
 // mapping.setBindingType(BindingType.XML);
 return mapping;
}

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

/**
   * Creates an instance of a Castor XML specific {@link Mapping} instance.
   * @return a Castor XML specific {@link Mapping} instance.
   */
  public Mapping createMapping() {
    Mapping mapping = new Mapping();
//        mapping.setBindingType(BindingType.XML);
    return mapping;
  }

代码示例来源:origin: stackoverflow.com

private String fileLoadPath="conf/Configuration.xml";
private String mappingPath="conf/mapping.xml";

 Mapping mapping = new Mapping();
 mapping.loadMapping(mappingPath);

Configuration configuration = (Configuration)new Unmarshaller(mapping).unmarshal(fileLoadPath);

代码示例来源:origin: stackoverflow.com

mapper = new DozerBeanMapper();
 mapper.addMapping(new Mapping());

代码示例来源:origin: stackoverflow.com

Marshaller marshaller = new Marshaller();
 Mapping mapping = new Mapping();
 mapping.loadMapping("test-mapping.xml");
 marshaller.setMapping(mapping);
 TestObj obj = new TestObj();
 StringWriter writer = new StringWriter();
 obj.setParam1("1");
 obj.setParam2("2");
 marshaller.setWriter(writer);
 marshaller.marshal(obj);
 System.out.println("output:"+writer.toString());

代码示例来源:origin: com.github.muff1nman.chameleon/core

final Mapping mapping = new Mapping(XmlSerializer.class.getClassLoader());

代码示例来源:origin: org.apache.portals.jetspeed-2/jetspeed-page-manager

protected void createCastorClassDescriptorResolver(String mappingFile) throws MappingException
{
  Mapping mapping=null;
  try
  {
    InputStream stream = getClass().getResourceAsStream(mappingFile);
    if (log.isDebugEnabled())
    {
      log.debug("Loading psml mapping file " + mappingFile);
    }
    mapping = new Mapping();
    InputSource is = new InputSource(stream);
    is.setSystemId(mappingFile);
    mapping.loadMapping(is);
  }
  catch (Exception e)
  {
    IllegalStateException ise = new IllegalStateException("Error in psml mapping creation");
    ise.initCause(e);
    throw ise;
  }
  this.classDescriptorResolver =
    ClassDescriptorResolverFactory.createClassDescriptorResolver(BindingType.XML);
   MappingUnmarshaller mappingUnmarshaller = new MappingUnmarshaller();
   MappingLoader mappingLoader = mappingUnmarshaller.getMappingLoader(mapping, BindingType.XML);
   classDescriptorResolver.setMappingLoader(mappingLoader);
}

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

/**
 * Loads a package mapping file for the given package name using the
 * provided ClassLoader.
 *
 * @param packageName The name of the package to load the mapping file for.
 * @return The loaded Mapping or <code>null</code> if no mapping file
 *         is available for the given package.
 * @throws MappingException
 */
private Mapping loadMapping(final String packageName, final ClassLoader classLoader)
throws MappingException {
  URL url = classLoader.getResource(ResolveHelpers.getQualifiedFileName(
      XMLConstants.PKG_MAPPING_FILE, packageName));
  if (url == null) { return null; }
  try {
    Mapping mapping = new Mapping(classLoader);
    mapping.loadMapping(url);
    return mapping;
  } catch (java.io.IOException ioex) {
    throw new MappingException(ioex);
  }
}

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

/**
 * Loads a package mapping file for the given package name using the provided ClassLoader.
 *
 * @param packageName The name of the package to load the mapping file for.
 * @return The loaded Mapping or <code>null</code> if no mapping file is available for the given
 *         package.
 * @throws MappingException
 */
private Mapping loadMapping(final String packageName, final ClassLoader classLoader)
  throws MappingException {
 URL url = classLoader.getResource(
   ResolveHelpers.getQualifiedFileName(XMLConstants.PKG_MAPPING_FILE, packageName));
 if (url == null) {
  return null;
 }
 try {
  Mapping mapping = new Mapping(classLoader);
  mapping.loadMapping(url);
  return mapping;
 } catch (java.io.IOException ioex) {
  throw new MappingException(ioex);
 }
}

代码示例来源:origin: org.apache.portals.applications/apa-webcontent2-portlets

this.mapper = new Mapping();
this.mapper.loadMapping(file.toURL());

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

mapping = new Mapping();
mapping.loadMapping(ClassLoaderUtils.getResource(mappingFile,
                         CastorTypeCreator.class));

代码示例来源:origin: org.apache.portals.applications/apa-webcontent-jar

this.mapper = new Mapping();
this.mapper.loadMapping(file.toURL());

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

Mapping mapping = new Mapping(getClass().getClassLoader());

代码示例来源:origin: apache/servicemix-bundles

Mapping mapping = new Mapping();
for (Resource mappingLocation : mappingLocations) {
  mapping.loadMapping(SaxResourceUtils.createInputSource(mappingLocation));

代码示例来源:origin: org.springframework.ws/spring-oxm

/**
 * Creates the Castor <code>XMLContext</code>. Subclasses can override this to create a custom context.
 * <p/>
 * The default implementation loads mapping files if defined, and the target class if not defined.
 *
 * @return the created resolver
 * @throws MappingException when the mapping file cannot be loaded
 * @throws IOException      in case of I/O errors
 * @see XMLContext#addMapping(org.exolab.castor.mapping.Mapping)
 * @see XMLContext#addClass(Class)
 */
protected XMLContext createXMLContext(Resource[] mappingLocations, Class targetClass)
    throws MappingException, IOException, ResolverException {
  XMLContext context = new XMLContext();
  if (!ObjectUtils.isEmpty(mappingLocations)) {
    Mapping mapping = new Mapping();
    for (int i = 0; i < mappingLocations.length; i++) {
      mapping.loadMapping(SaxUtils.createInputSource(mappingLocations[i]));
    }
    context.addMapping(mapping);
  }
  if (targetClass != null) {
    context.addClass(targetClass);
  }
  return context;
}

代码示例来源:origin: hmkcode/Java

Mapping mapping = new Mapping();
mapping.loadMapping("mapping.xml");
XMLContext context = new XMLContext();

代码示例来源:origin: tflobbe/solrmeter

@Override
public List<StatisticDescriptor> getStatisticDescriptors(String filePath)
    throws ParserException {
  try {
    Mapping mapping = new Mapping();
    mapping.loadMapping(FileUtils.findFileAsResource("StatisticDescriptorMapping.xml"));
    XMLContext context = new XMLContext();
    context.addMapping(mapping);
    InputSource source = new InputSource(FileUtils.findFileAsStream(filePath));
    Unmarshaller unmarshaller = context.createUnmarshaller();
    unmarshaller.setClass(StatisticList.class);
    StatisticList list = (StatisticList)unmarshaller.unmarshal(source);
    validate(list.getDescriptors());
    return list.getDescriptors();
  } catch (Exception e) {
    ParserException parserException = new ParserException("Exception parsing statistic descriptor files", e);
    Logger.getLogger(this.getClass()).error(parserException.getMessage(), parserException);
    throw parserException;
  } 
}

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

_mapping = new Mapping(loader);
InputSource source = new InputSource(mappingFile);
source.setSystemId(mappingFilePath);

代码示例来源:origin: org.apache.camel/camel-castor

protected XMLContext createXMLContext(ClassResolver resolver, ClassLoader contextClassLoader) throws Exception {
  XMLContext xmlContext = new XMLContext();
  if (ObjectHelper.isNotEmpty(getMappingFile())) {
    Mapping xmlMap;
    if (contextClassLoader != null) {
      xmlMap = new Mapping(contextClassLoader);
    } else {
      xmlMap = new Mapping();
    }
    xmlMap.loadMapping(resolver.loadResourceAsURL(getMappingFile()));
    xmlContext.addMapping(xmlMap);
  }
  if (getPackages() != null) {
    xmlContext.addPackages(getPackages());
  }
  if (getClassNames() != null) {
    for (String name : getClassNames()) {
      Class<?> clazz = resolver.resolveClass(name);
      xmlContext.addClass(clazz);
    }
  }
  return xmlContext;
}

代码示例来源:origin: OpenClinica/OpenClinica

Mapping mapping = new Mapping();
mapping.loadMapping(getCoreResources().getURL("mappingMarshallerMetadata.xml"));

相关文章