当前位置: 首页>>代码示例>>Java>>正文


Java Unmarshaller.unmarshal方法代码示例

本文整理汇总了Java中org.exolab.castor.xml.Unmarshaller.unmarshal方法的典型用法代码示例。如果您正苦于以下问题:Java Unmarshaller.unmarshal方法的具体用法?Java Unmarshaller.unmarshal怎么用?Java Unmarshaller.unmarshal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.exolab.castor.xml.Unmarshaller的用法示例。


在下文中一共展示了Unmarshaller.unmarshal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStatisticDescriptors

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
@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;
	} 
}
 
开发者ID:lafourchette,项目名称:solrmeter,代码行数:21,代码来源:StatisticsParserCastorImpl.java

示例2: readFromFile

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static List<Synonym> readFromFile(String filename) throws Exception {
	Mapping mapping = getMapping();
	Unmarshaller unmarshaller = new Unmarshaller(ArrayList.class);
	unmarshaller.setMapping(mapping);

	File file = new File(filename);

       if (file.exists() && !file.isFile()) {
           throw new IOException("File " + file.getAbsolutePath() + " exists but is not a file.");
       }

	if (!file.exists() || file.length() == 0) {
		return Collections.emptyList();
	}

	Reader reader = new FileReader(file);
	return (List<Synonym>) unmarshaller.unmarshal(reader);
}
 
开发者ID:realrolfje,项目名称:anonimatron,代码行数:20,代码来源:SynonymMapper.java

示例3: unserializeTxnRes

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
@Override
public TxnRes unserializeTxnRes(String xml) throws IOException {
	try {
        Unmarshaller unmarshaller = new Unmarshaller(_mapping);
        return (TxnRes) unmarshaller.unmarshal(new InputSource(new ByteArrayInputStream(xml.getBytes())));
        
	} catch (Exception e) {
		throw new IOException("Exception occured during XML unmarshalling.", e);
		
	}
}
 
开发者ID:neopeak,项目名称:brownsocks-payments-enets,代码行数:12,代码来源:CastorXMLSerializer.java

示例4: readFromFile

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
public static Configuration readFromFile(String filename) throws Exception {
	Mapping mapping = getMapping();
	Unmarshaller unmarshaller = new Unmarshaller(mapping);

	File file = new File(filename);
	Reader reader = new FileReader(file);
	Configuration configuration = (Configuration)unmarshaller.unmarshal(reader);
	LOG.info("Configuration read from " + file.getAbsoluteFile());
	return configuration;
}
 
开发者ID:realrolfje,项目名称:anonimatron,代码行数:11,代码来源:Configuration.java

示例5: unmarshal

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
public static Varbind unmarshal(final Reader reader) throws MarshalException, ValidationException {
    return (Varbind) Unmarshaller.unmarshal(Varbind.class, reader);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:4,代码来源:Varbind.java

示例6: unmarshal

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
public static Script unmarshal(final Reader reader) throws MarshalException, ValidationException {
    return (Script) Unmarshaller.unmarshal(Script.class, reader);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:4,代码来源:Script.java

示例7: unmarshal

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
public static Security unmarshal(final Reader reader) throws MarshalException, ValidationException {
    return (Security) Unmarshaller.unmarshal(Security.class, reader);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:4,代码来源:Security.java

示例8: unmarshal

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
public static Maskelement unmarshal(final Reader reader) throws MarshalException, ValidationException {
    return (Maskelement) Unmarshaller.unmarshal(Maskelement.class, reader);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:4,代码来源:Maskelement.java

示例9: unmarshal

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
public static Mask unmarshal(final Reader reader) throws MarshalException, ValidationException {
    return (Mask) Unmarshaller.unmarshal(Mask.class, reader);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:4,代码来源:Mask.java

示例10: unmarshal

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
public static Autoaction unmarshal(final Reader reader) throws MarshalException, ValidationException {
    return (Autoaction) Unmarshaller.unmarshal(Autoaction.class, reader);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:4,代码来源:Autoaction.java

示例11: unmarshal

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
public static Operaction unmarshal(final Reader reader) throws MarshalException, ValidationException {
    return (Operaction) Unmarshaller.unmarshal(Operaction.class, reader);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:4,代码来源:Operaction.java

示例12: unmarshal

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
/**
 * Method unmarshal.
 * 
 * @param reader
 * @throws org.exolab.castor.xml.MarshalException if object is
 * null or if any SAXException is thrown during marshaling
 * @throws org.exolab.castor.xml.ValidationException if this
 * object is an invalid instance according to the schema
 * @return the unmarshaled
 * org.opennms.netmgt.config.collectd.jmx.Mbeans
 */
@Deprecated
public static Mbeans unmarshal(
        final java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
    return (Mbeans) Unmarshaller.unmarshal(Mbeans.class, reader);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:Mbeans.java

示例13: unmarshal

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
/**
 * Method unmarshal.
 * 
 * @param reader
 * @throws org.exolab.castor.xml.MarshalException if object is
 * null or if any SAXException is thrown during marshaling
 * @throws org.exolab.castor.xml.ValidationException if this
 * object is an invalid instance according to the schema
 * @return the unmarshaled
 * org.opennms.netmgt.config.collectd.jmx.Attrib
 */
@Deprecated
public static Attrib unmarshal(
        final java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
    return (Attrib) Unmarshaller.unmarshal(Attrib.class, reader);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:Attrib.java

示例14: unmarshal

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
/**
 * Method unmarshal.
 * 
 * @param reader
 * @throws org.exolab.castor.xml.MarshalException if object is
 * null or if any SAXException is thrown during marshaling
 * @throws org.exolab.castor.xml.ValidationException if this
 * object is an invalid instance according to the schema
 * @return the unmarshaled
 * org.opennms.netmgt.config.collectd.jmx.CompAttrib
 */
@Deprecated
public static CompAttrib unmarshal(
        final java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
    return (CompAttrib) Unmarshaller.unmarshal(CompAttrib.class, reader);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:CompAttrib.java

示例15: unmarshal

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
/**
 * Method unmarshal.
 * 
 * @param reader
 * @throws org.exolab.castor.xml.MarshalException if object is
 * null or if any SAXException is thrown during marshaling
 * @throws org.exolab.castor.xml.ValidationException if this
 * object is an invalid instance according to the schema
 * @return the unmarshaled
 * org.opennms.netmgt.config.collectd.jmx.JmxDatacollectionConfig
 */
@Deprecated
public static JmxDatacollectionConfig unmarshal(
        final java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
    return (JmxDatacollectionConfig) Unmarshaller.unmarshal(JmxDatacollectionConfig.class, reader);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:JmxDatacollectionConfig.java


注:本文中的org.exolab.castor.xml.Unmarshaller.unmarshal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。