本文整理汇总了Java中com.thoughtworks.xstream.core.DefaultConverterLookup类的典型用法代码示例。如果您正苦于以下问题:Java DefaultConverterLookup类的具体用法?Java DefaultConverterLookup怎么用?Java DefaultConverterLookup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultConverterLookup类属于com.thoughtworks.xstream.core包,在下文中一共展示了DefaultConverterLookup类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: XStream
import com.thoughtworks.xstream.core.DefaultConverterLookup; //导入依赖的package包/类
private XStream(
final ReflectionProvider reflectionProvider, final HierarchicalStreamDriver driver,
final ClassLoaderReference classLoader, final Mapper mapper,
final DefaultConverterLookup defaultConverterLookup) {
this(reflectionProvider, driver, classLoader, mapper, new ConverterLookup() {
@Override
public Converter lookupConverterForType(final Class<?> type) {
return defaultConverterLookup.lookupConverterForType(type);
}
}, new ConverterRegistry() {
@Override
public void registerConverter(final Converter converter, final int priority) {
defaultConverterLookup.registerConverter(converter, priority);
}
});
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:XStream.java
示例2: setUp
import com.thoughtworks.xstream.core.DefaultConverterLookup; //导入依赖的package包/类
protected void setUp() throws Exception {
super.setUp();
final ClassAliasingMapper classAliasingMapper = new ClassAliasingMapper(
new DefaultMapper(new ClassLoaderReference(getClass().getClassLoader())));
classAliasingMapper.addClassAlias("x", X.class);
classAliasingMapper.addClassAlias("software", Software.class);
classAliasingMapper.addClassAlias("open-source", OpenSourceSoftware.class);
mapper = new DefaultImplementationsMapper(new ArrayMapper(classAliasingMapper));
reflectionProvider = new SunUnsafeReflectionProvider();
driver = new XppDriver();
converterLookup = new DefaultConverterLookup();
converterLookup.registerConverter(
new SingleValueConverterWrapper(new StringConverter()), 0);
converterLookup.registerConverter(
new SingleValueConverterWrapper(new IntConverter()), 0);
converterLookup.registerConverter(new ArrayConverter(mapper), 0);
converterLookup.registerConverter(
new ReflectionConverter(mapper, reflectionProvider), -1);
}
开发者ID:x-stream,项目名称:xstream,代码行数:23,代码来源:ToAttributedValueConverterTest.java
示例3: XStream
import com.thoughtworks.xstream.core.DefaultConverterLookup; //导入依赖的package包/类
private XStream(ReflectionProvider paramReflectionProvider, HierarchicalStreamDriver paramHierarchicalStreamDriver, ClassLoaderReference paramClassLoaderReference, Mapper paramMapper, DefaultConverterLookup paramDefaultConverterLookup)
{
this(paramReflectionProvider, paramHierarchicalStreamDriver, paramClassLoaderReference, paramMapper, new ConverterLookup()
{
public Converter lookupConverterForType(Class paramAnonymousClass)
{
return XStream.this.lookupConverterForType(paramAnonymousClass);
}
}
, new ConverterRegistry()
{
public void registerConverter(Converter paramAnonymousConverter, int paramAnonymousInt)
{
XStream.this.registerConverter(paramAnonymousConverter, paramAnonymousInt);
}
});
}
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:18,代码来源:XStream.java
示例4: XStream
import com.thoughtworks.xstream.core.DefaultConverterLookup; //导入依赖的package包/类
public XStream(ReflectionProvider reflectionProvider,
ClassMapper classMapper, HierarchicalStreamDriver driver,
String classAttributeIdentifier) {
jvm = new JVM();
if (reflectionProvider == null) {
reflectionProvider = jvm.bestReflectionProvider();
}
this.reflectionProvider = reflectionProvider;
this.hierarchicalStreamDriver = driver;
//this.classLoaderReference = new ClassLoaderReference(
// new CompositeClassLoader()); // サーブレットで実行するとメモリが増えてしまう
this.classLoaderReference = new ClassLoaderReference(
getClass().getClassLoader());
this.classMapper = classMapper == null ? buildMapper(classAttributeIdentifier)
: classMapper;
converterLookup = new DefaultConverterLookup(this.classMapper);
setupAliases();
setupDefaultImplementations();
setupConverters();
setupImmutableTypes();
// setMode(XPATH_REFERENCES);
setMode(NO_REFERENCES);
}
开发者ID:reflexworks,项目名称:reflexcore,代码行数:24,代码来源:XStream.java
示例5: saveXML
import com.thoughtworks.xstream.core.DefaultConverterLookup; //导入依赖的package包/类
public static void saveXML( Object o , String fileName ) {
BoofcvClassLoader loader = new BoofcvClassLoader();
XStreamAppletVersion xstream = new XStreamAppletVersion(new PureJavaReflectionProvider(),new DomDriver(),loader,null,new DefaultConverterLookup(), null);
// XStream xstream = new XStream(new PureJavaReflectionProvider(),new DomDriver(),loader,null,new DefaultConverterLookup(), null);
xstream.registerConverter(new JavaBeanConverter(xstream.getMapper()));
try {
xstream.toXML(o,new FileOutputStream(fileName));
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:13,代码来源:BoofMiscOps.java
示例6: loadXML
import com.thoughtworks.xstream.core.DefaultConverterLookup; //导入依赖的package包/类
public static <T> T loadXML( String fileName ) {
BoofcvClassLoader loader = new BoofcvClassLoader();
XStreamAppletVersion xstream = new XStreamAppletVersion(new PureJavaReflectionProvider(),new DomDriver(),loader,null,new DefaultConverterLookup(), null);
xstream.registerConverter(new JavaBeanConverter(xstream.getMapper()));
try {
return (T)xstream.fromXML(new FileReader(fileName));
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:12,代码来源:BoofMiscOps.java
注:本文中的com.thoughtworks.xstream.core.DefaultConverterLookup类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论