• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DefaultMapper类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.thoughtworks.xstream.mapper.DefaultMapper的典型用法代码示例。如果您正苦于以下问题:Java DefaultMapper类的具体用法?Java DefaultMapper怎么用?Java DefaultMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DefaultMapper类属于com.thoughtworks.xstream.mapper包,在下文中一共展示了DefaultMapper类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setUp

点赞 3

import com.thoughtworks.xstream.mapper.DefaultMapper; //导入依赖的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

示例2: BeanXStreamConverter

点赞 3

import com.thoughtworks.xstream.mapper.DefaultMapper; //导入依赖的package包/类
@Inject
public BeanXStreamConverter(XStreamConfiguration configuration) {
  rp = new PureJavaReflectionProvider();
  Mapper dmapper = new DefaultMapper(this.getClass().getClassLoader());
  /*
   * Putting this here means only one conversion per thread may be active at
   * any one time, but since the conversion process is atomic this will not
   * matter unless the class is extended.
   */
  writerStack = new ThreadSafeWriterStack();


  /*
   * create a driver that wires into a standard driver, and updates the stack
   * position.
   */
  driver = new StackDriver(new XppDriver(), writerStack, configuration.getNameSpaces());
  /*
   * Create an interface class mapper that understands class hierarchy for
   * single items
   */
  for (XStreamConfiguration.ConverterSet c : MAPPER_SCOPES) {
    converterMap.put(c, configuration.getConverterConfig(c,rp,dmapper,driver,writerStack));
  }
}
 

开发者ID:inevo,
项目名称:shindig-1.1-BETA5-incubating,
代码行数:26,
代码来源:BeanXStreamConverter.java

示例3: createStringPlan

点赞 2

import com.thoughtworks.xstream.mapper.DefaultMapper; //导入依赖的package包/类
/**
 * 将执行计划序列化成字符串
 */
public static String createStringPlan(PhysicalPlan plan)
{
    XStream xstream = new XStream(new DomDriver(XML_CHARSET));
    xstream.autodetectAnnotations(true);
    PhysicalPlanLoader.setAlias(xstream);
    xstream.registerConverter(new MapConverter(new DefaultMapper(new ClassLoaderReference(PhysicalPlanWriter.class.getClassLoader()))));
    return xstream.toXML(plan);
}
 

开发者ID:HuaweiBigData,
项目名称:StreamCQL,
代码行数:12,
代码来源:PhysicalPlanWriter.java

示例4: testOwnMapperChainCanBeRegistered

点赞 2

import com.thoughtworks.xstream.mapper.DefaultMapper; //导入依赖的package包/类
public void testOwnMapperChainCanBeRegistered() {
    ClassLoaderReference classLoaderReference = new ClassLoaderReference(getClass().getClassLoader());
    Mapper mapper = new DefaultMapper(classLoaderReference);
    xstream = new XStream(new PureJavaReflectionProvider(), new DomDriver(), getClass().getClassLoader(), mapper);
    
    String expected = "" +
            "<com.thoughtworks.acceptance.objects.Software>\n" +
            "  <vendor>ms</vendor>\n" +
            "  <name>word</name>\n" +
            "</com.thoughtworks.acceptance.objects.Software>";
    assertEquals(expected, xstream.toXML(new Software("ms", "word")));
}
 

开发者ID:x-stream,
项目名称:xstream,
代码行数:13,
代码来源:CustomMapperTest.java

示例5: createEnumMapper

点赞 2

import com.thoughtworks.xstream.mapper.DefaultMapper; //导入依赖的package包/类
static Mapper createEnumMapper(final Mapper mapper) {
    return new EnumMapper(new UseAttributeForEnumMapper(mapper.lookupMapperOfType(DefaultMapper.class)));
}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:4,
代码来源:UseAttributeForEnumMapper.java

示例6: JavaClassConverter

点赞 2

import com.thoughtworks.xstream.mapper.DefaultMapper; //导入依赖的package包/类
public JavaClassConverter(ClassLoaderReference paramClassLoaderReference)
{
  this(new DefaultMapper(paramClassLoaderReference));
}
 

开发者ID:mmmsplay10,
项目名称:QuizUpWinner,
代码行数:5,
代码来源:JavaClassConverter.java

示例7: JavaFieldConverter

点赞 2

import com.thoughtworks.xstream.mapper.DefaultMapper; //导入依赖的package包/类
public JavaFieldConverter(ClassLoaderReference paramClassLoaderReference)
{
  this(new JavaClassConverter(paramClassLoaderReference), new DefaultMapper(paramClassLoaderReference));
}
 

开发者ID:mmmsplay10,
项目名称:QuizUpWinner,
代码行数:5,
代码来源:JavaFieldConverter.java

示例8: JavaClassConverter

点赞 1

import com.thoughtworks.xstream.mapper.DefaultMapper; //导入依赖的package包/类
/**
 * Construct a JavaClassConverter.
 * 
 * @param classLoaderReference the reference to the {@link ClassLoader} of the XStream instance
 * @since 1.4.5
 */
public JavaClassConverter(final ClassLoaderReference classLoaderReference) {
    this(new DefaultMapper(classLoaderReference));
}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:10,
代码来源:JavaClassConverter.java

示例9: JavaFieldConverter

点赞 1

import com.thoughtworks.xstream.mapper.DefaultMapper; //导入依赖的package包/类
/**
 * Construct a JavaFieldConverter.
 * 
 * @param classLoaderReference the reference to the {@link ClassLoader} of the XStream instance
 * @since 1.4.5
 */
public JavaFieldConverter(final ClassLoaderReference classLoaderReference) {
    this(new JavaClassConverter(classLoaderReference), new DefaultMapper(classLoaderReference));
}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:10,
代码来源:JavaFieldConverter.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)