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


Java ClassAliasingMapper类代码示例

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


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

示例1: setUp

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

import com.thoughtworks.xstream.mapper.ClassAliasingMapper; //导入依赖的package包/类
private void setupMappers() {
    packageAliasingMapper = mapper.lookupMapperOfType(PackageAliasingMapper.class);
    classAliasingMapper = mapper.lookupMapperOfType(ClassAliasingMapper.class);
    fieldAliasingMapper = mapper.lookupMapperOfType(FieldAliasingMapper.class);
    attributeMapper = mapper.lookupMapperOfType(AttributeMapper.class);
    attributeAliasingMapper = mapper.lookupMapperOfType(AttributeAliasingMapper.class);
    systemAttributeAliasingMapper = mapper.lookupMapperOfType(SystemAttributeAliasingMapper.class);
    implicitCollectionMapper = mapper.lookupMapperOfType(ImplicitCollectionMapper.class);
    defaultImplementationsMapper = mapper.lookupMapperOfType(DefaultImplementationsMapper.class);
    immutableTypesMapper = mapper.lookupMapperOfType(ImmutableTypesMapper.class);
    localConversionMapper = mapper.lookupMapperOfType(LocalConversionMapper.class);
    securityMapper = mapper.lookupMapperOfType(SecurityMapper.class);
    annotationMapper = mapper.lookupMapperOfType(AnnotationMapper.class);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:XStream.java

示例3: setupMappers

import com.thoughtworks.xstream.mapper.ClassAliasingMapper; //导入依赖的package包/类
private void setupMappers() {
    packageAliasingMapper = mapper.lookupMapperOfType(PackageAliasingMapper.class);
    classAliasingMapper = mapper.lookupMapperOfType(ClassAliasingMapper.class);
    elementIgnoringMapper = mapper.lookupMapperOfType(ElementIgnoringMapper.class);
    fieldAliasingMapper = mapper.lookupMapperOfType(FieldAliasingMapper.class);
    attributeMapper = mapper.lookupMapperOfType(AttributeMapper.class);
    attributeAliasingMapper = mapper.lookupMapperOfType(AttributeAliasingMapper.class);
    systemAttributeAliasingMapper = mapper.lookupMapperOfType(SystemAttributeAliasingMapper.class);
    implicitCollectionMapper = mapper.lookupMapperOfType(ImplicitCollectionMapper.class);
    defaultImplementationsMapper = mapper.lookupMapperOfType(DefaultImplementationsMapper.class);
    immutableTypesMapper = mapper.lookupMapperOfType(ImmutableTypesMapper.class);
    localConversionMapper = mapper.lookupMapperOfType(LocalConversionMapper.class);
    securityMapper = mapper.lookupMapperOfType(SecurityMapper.class);
    annotationMapper = mapper.lookupMapperOfType(AnnotationMapper.class);
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:16,代码来源:XStream.java

示例4: makeXStream

import com.thoughtworks.xstream.mapper.ClassAliasingMapper; //导入依赖的package包/类
@Nonnull
public static XStream makeXStream() {
  XStream xstream = new XStream();
  if (ConfigProvider.class.getClassLoader() != null) {
    xstream.setClassLoader(ConfigProvider.class.getClassLoader());
  }

  xstream.registerLocalConverter(Stash.class, "contents", new NamedMapConverter(xstream.getMapper(), "component", "name", String.class, "ppm", Double.class,
      true, true, xstream.getConverterLookup()));
  xstream.addImplicitCollection(Material.class, "components");
  xstream.useAttributeFor(Material.class, "name");
  xstream.useAttributeFor(Material.class, "prio");
  xstream.useAttributeFor(Material.class, "volume");
  xstream.useAttributeFor(Material.class, "density");
  xstream.useAttributeFor(Component.class, "name");
  xstream.useAttributeFor(Component.class, "factor");
  xstream.useAttributeFor(Component.class, "count");
  xstream.useAttributeFor(Component.class, "granularity");
  xstream.useAttributeFor(MinecraftItem.class, "modID");
  xstream.useAttributeFor(MinecraftItem.class, "itemName");
  xstream.useAttributeFor(MinecraftItem.class, "itemMeta");
  xstream.useAttributeFor(OreDictionaryItem.class, "oreDictionary");
  xstream.alias("water", Water.class);
  xstream.alias("material", Material.class);
  xstream.alias("component", Component.class);
  xstream.alias("OreDictionaryItem", OreDictionaryItem.class);
  xstream.alias("MinecraftItem", MinecraftItem.class);

  ClassAliasingMapper mapper = new ClassAliasingMapper(xstream.getMapper());
  mapper.addClassAlias("amount", Double.class);
  xstream.registerLocalConverter(Component.class, "granularities", new CollectionConverter(mapper));
  return xstream;
}
 
开发者ID:HenryLoenwind,项目名称:EnderIOAddons,代码行数:34,代码来源:ConfigProvider.java

示例5: setupMappers

import com.thoughtworks.xstream.mapper.ClassAliasingMapper; //导入依赖的package包/类
private void setupMappers()
{
  this.packageAliasingMapper = ((PackageAliasingMapper)this.mapper.lookupMapperOfType(PackageAliasingMapper.class));
  this.classAliasingMapper = ((ClassAliasingMapper)this.mapper.lookupMapperOfType(ClassAliasingMapper.class));
  this.fieldAliasingMapper = ((FieldAliasingMapper)this.mapper.lookupMapperOfType(FieldAliasingMapper.class));
  this.attributeMapper = ((AttributeMapper)this.mapper.lookupMapperOfType(AttributeMapper.class));
  this.attributeAliasingMapper = ((AttributeAliasingMapper)this.mapper.lookupMapperOfType(AttributeAliasingMapper.class));
  this.systemAttributeAliasingMapper = ((SystemAttributeAliasingMapper)this.mapper.lookupMapperOfType(SystemAttributeAliasingMapper.class));
  this.implicitCollectionMapper = ((ImplicitCollectionMapper)this.mapper.lookupMapperOfType(ImplicitCollectionMapper.class));
  this.defaultImplementationsMapper = ((DefaultImplementationsMapper)this.mapper.lookupMapperOfType(DefaultImplementationsMapper.class));
  this.immutableTypesMapper = ((ImmutableTypesMapper)this.mapper.lookupMapperOfType(ImmutableTypesMapper.class));
  this.localConversionMapper = ((LocalConversionMapper)this.mapper.lookupMapperOfType(LocalConversionMapper.class));
  this.securityMapper = ((SecurityMapper)this.mapper.lookupMapperOfType(SecurityMapper.class));
  this.annotationConfiguration = ((AnnotationConfiguration)this.mapper.lookupMapperOfType(AnnotationConfiguration.class));
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:16,代码来源:XStream.java

示例6: registerStringAlias

import com.thoughtworks.xstream.mapper.ClassAliasingMapper; //导入依赖的package包/类
private static void registerStringAlias(XStream xstream, Class clazz, String tag) {
    ClassAliasingMapper mapper = new ClassAliasingMapper(xstream.getMapper());
    mapper.addClassAlias(tag, String.class);
    xstream.registerLocalConverter(clazz, tag + "s", new CollectionConverter(mapper));
}
 
开发者ID:fabric8io,项目名称:fabric8-build,代码行数:6,代码来源:AssemblyPrinter.java

示例7: alias

import com.thoughtworks.xstream.mapper.ClassAliasingMapper; //导入依赖的package包/类
public void alias(String paramString, Class paramClass)
{
  if (this.classAliasingMapper == null)
    throw new InitializationException("No " + ClassAliasingMapper.class.getName() + " available");
  this.classAliasingMapper.addClassAlias(paramString, paramClass);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:7,代码来源:XStream.java

示例8: aliasType

import com.thoughtworks.xstream.mapper.ClassAliasingMapper; //导入依赖的package包/类
public void aliasType(String paramString, Class paramClass)
{
  if (this.classAliasingMapper == null)
    throw new InitializationException("No " + ClassAliasingMapper.class.getName() + " available");
  this.classAliasingMapper.addTypeAlias(paramString, paramClass);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:7,代码来源:XStream.java

示例9: alias

import com.thoughtworks.xstream.mapper.ClassAliasingMapper; //导入依赖的package包/类
/**
 * Alias a Class to a shorter name to be used in XML elements.
 * 
 * @param name Short name
 * @param type Type to be aliased
 * @throws InitializationException if no {@link ClassAliasingMapper} is available
 */
public void alias(final String name, final Class<?> type) {
    if (classAliasingMapper == null) {
        throw new InitializationException("No " + ClassAliasingMapper.class.getName() + " available");
    }
    classAliasingMapper.addClassAlias(name, type);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:XStream.java

示例10: aliasType

import com.thoughtworks.xstream.mapper.ClassAliasingMapper; //导入依赖的package包/类
/**
 * Alias a type to a shorter name to be used in XML elements. Any class that is assignable to this type will be
 * aliased to the same name.
 * 
 * @param name Short name
 * @param type Type to be aliased
 * @since 1.2
 * @throws InitializationException if no {@link ClassAliasingMapper} is available
 */
public void aliasType(final String name, final Class<?> type) {
    if (classAliasingMapper == null) {
        throw new InitializationException("No " + ClassAliasingMapper.class.getName() + " available");
    }
    classAliasingMapper.addTypeAlias(name, type);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:XStream.java

示例11: alias

import com.thoughtworks.xstream.mapper.ClassAliasingMapper; //导入依赖的package包/类
/**
 * Alias a Class to a shorter name to be used in XML elements.
 *
 * @param name Short name
 * @param type Type to be aliased
 * @throws InitializationException if no {@link ClassAliasingMapper} is available
 */
public void alias(final String name, final Class<?> type) {
    if (classAliasingMapper == null) {
        throw new InitializationException("No " + ClassAliasingMapper.class.getName() + " available");
    }
    classAliasingMapper.addClassAlias(name, type);
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:14,代码来源:XStream.java

示例12: aliasType

import com.thoughtworks.xstream.mapper.ClassAliasingMapper; //导入依赖的package包/类
/**
 * Alias a type to a shorter name to be used in XML elements. Any class that is assignable to this type will be
 * aliased to the same name.
 *
 * @param name Short name
 * @param type Type to be aliased
 * @since 1.2
 * @throws InitializationException if no {@link ClassAliasingMapper} is available
 */
public void aliasType(final String name, final Class<?> type) {
    if (classAliasingMapper == null) {
        throw new InitializationException("No " + ClassAliasingMapper.class.getName() + " available");
    }
    classAliasingMapper.addTypeAlias(name, type);
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:16,代码来源:XStream.java


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