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


Java ConverterLookup类代码示例

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


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

示例1: ToAttributedValueConverter

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
/**
 * Creates a new ToAttributedValueConverter instance.
 * 
 * @param type the type that is handled by this converter instance
 * @param mapper the mapper in use
 * @param reflectionProvider the reflection provider in use
 * @param lookup the converter lookup in use
 * @param valueFieldName the field defining the tag's value (may be null)
 * @param valueDefinedIn the type defining the field
 */
public ToAttributedValueConverter(
        final Class<?> type, final Mapper mapper, final ReflectionProvider reflectionProvider,
        final ConverterLookup lookup, final String valueFieldName, final Class<?> valueDefinedIn) {
    this.type = type;
    this.mapper = mapper;
    this.reflectionProvider = reflectionProvider;
    this.lookup = lookup;

    if (valueFieldName == null) {
        valueField = null;
    } else {
        Field field = null;
        try {
            field = (valueDefinedIn != null ? valueDefinedIn : type).getDeclaredField(valueFieldName);
            if (!field.isAccessible()) {
                field.setAccessible(true);
            }
        } catch (final NoSuchFieldException e) {
            throw new IllegalArgumentException(e.getMessage() + ": " + valueFieldName);
        }
        valueField = field;
    }
    enumMapper = UseAttributeForEnumMapper.createEnumMapper(mapper);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:ToAttributedValueConverter.java

示例2: XStream

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

示例3: IdentifiableToIdConverter

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
/**
 * Creates a new ToAttributedValueConverter instance.
 * 
 * @param mapper the mapper in use
 * @param reflectionProvider the reflection provider in use
 * @param lookup the converter lookup in use
 * @param valueFieldName the field defining the tag's value (may be null)
 * @param valueDefinedIn the type defining the field
 */
public IdentifiableToIdConverter(
    final Class<Identifiable<?>> type, final Mapper mapper, final ReflectionProvider reflectionProvider,
    final ConverterLookup lookup, final String valueFieldName, Class<?> valueDefinedIn) {
    this.type = type;

       Field field = null;
       try {
           field = (valueDefinedIn != null ? valueDefinedIn : type.getSuperclass())
               .getDeclaredField("id");
          
           if (!field.isAccessible()) {
               field.setAccessible(true);
           }
       } catch (NoSuchFieldException e) {
           throw new IllegalArgumentException(e.getMessage() + ": " + valueFieldName);
       }
}
 
开发者ID:alex-bretet,项目名称:cloudstreetmarket.com,代码行数:27,代码来源:IdentifiableToIdConverter.java

示例4: AnnotationMapper

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
/**
 * Construct an AnnotationMapper.
 *
 * @param wrapped the next {@link Mapper} in the chain
 * @since 1.4.5
 */
public AnnotationMapper(
        final Mapper wrapped, final ConverterRegistry converterRegistry, final ConverterLookup converterLookup,
        final ClassLoaderReference classLoaderReference, final ReflectionProvider reflectionProvider) {
    super(wrapped);
    this.converterRegistry = converterRegistry;
    annotatedTypes.add(Object.class);
    setupMappers();
    locked = true;

    final ClassLoader classLoader = classLoaderReference.getReference();
    arguments = new Object[]{
        this, classLoaderReference, reflectionProvider, converterLookup, new JVM(), classLoader != null
            ? classLoader
            : new TypedNull<>(ClassLoader.class)};
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:22,代码来源:AnnotationMapper.java

示例5: testCanReadXmlUnfriendlyXPathReferences

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
public void testCanReadXmlUnfriendlyXPathReferences() {
    xstream.setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(ReferenceByXPathMarshallingStrategy.RELATIVE) {

        protected TreeUnmarshaller createUnmarshallingContext(Object root,
            HierarchicalStreamReader reader, ConverterLookup converterLookup, Mapper mapper) {
            return new XStream12ReferenceByXPathUnmarshaller(root, reader, converterLookup, mapper);
        }
        
    });
    xstream.alias("foo$bar", StringBuffer.class);
    xstream.alias("x_y", StringBuffer.class);
    String xml =
        "<list>\n" +
        "  <foo_-bar>foo</foo_-bar>\n" +
        "  <foo_-bar reference=\"../foo$bar\"/>\n" +
        "  <x__y>bar</x__y>\n" +
        "  <x__y reference=\"../x_y\"/>\n" +
        "</list>";
    
    List list = (List)xstream.fromXML(xml);
    assertEquals(4, list.size());
    assertSame(list.get(0), list.get(1));
    assertEquals("foo", list.get(0).toString());
    assertSame(list.get(2), list.get(3));
    assertEquals("bar", list.get(2).toString());
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:27,代码来源:XStream12CompatibilityTest.java

示例6: XStream

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
public XStream(ReflectionProvider paramReflectionProvider, HierarchicalStreamDriver paramHierarchicalStreamDriver, ClassLoaderReference paramClassLoaderReference, Mapper paramMapper, ConverterLookup paramConverterLookup, ConverterRegistry paramConverterRegistry)
{
  if (paramReflectionProvider == null)
    paramReflectionProvider = JVM.newReflectionProvider();
  this.reflectionProvider = paramReflectionProvider;
  this.hierarchicalStreamDriver = paramHierarchicalStreamDriver;
  this.classLoaderReference = paramClassLoaderReference;
  this.converterLookup = paramConverterLookup;
  this.converterRegistry = paramConverterRegistry;
  Mapper localMapper;
  if (paramMapper == null)
    localMapper = buildMapper();
  else
    localMapper = paramMapper;
  this.mapper = localMapper;
  setupMappers();
  setupSecurity();
  setupAliases();
  setupDefaultImplementations();
  setupConverters();
  setupImmutableTypes();
  setMode(1003);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:24,代码来源:XStream.java

示例7: AnnotationMapper

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
/**
 * Construct an AnnotationMapper.
 * 
 * @param wrapped the next {@link Mapper} in the chain
 * @since 1.4.5
 */
public AnnotationMapper(
        final Mapper wrapped, final ConverterRegistry converterRegistry, final ConverterLookup converterLookup,
        final ClassLoaderReference classLoaderReference, final ReflectionProvider reflectionProvider) {
    super(wrapped);
    this.converterRegistry = converterRegistry;
    annotatedTypes.add(Object.class);
    setupMappers();
    locked = true;

    final ClassLoader classLoader = classLoaderReference.getReference();
    arguments = new Object[]{
        this, classLoaderReference, reflectionProvider, converterLookup, new JVM(),
        classLoader != null ? classLoader : new TypedNull<ClassLoader>(ClassLoader.class)};
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:AnnotationMapper.java

示例8: ReferenceByXPathUnmarshaller

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
public ReferenceByXPathUnmarshaller(
        final Object root, final HierarchicalStreamReader reader, final ConverterLookup converterLookup,
        final Mapper mapper) {
    super(root, reader, converterLookup, mapper);
    this.reader = new PathTrackingReader(reader, pathTracker);
    isNameEncoding = reader.underlyingReader() instanceof AbstractReader;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:ReferenceByXPathUnmarshaller.java

示例9: TreeUnmarshaller

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
public TreeUnmarshaller(
        final Object root, final HierarchicalStreamReader reader, final ConverterLookup converterLookup,
        final Mapper mapper) {
    this.root = root;
    this.reader = reader;
    this.converterLookup = converterLookup;
    this.mapper = mapper;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:TreeUnmarshaller.java

示例10: setConverterLookup

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
/**
 * Set a custom XStream {@link ConverterLookup} to use.
 * Also used as {@link ConverterRegistry} if the given reference implements it as well.
 * @since 4.0
 * @see DefaultConverterLookup
 */
public void setConverterLookup(ConverterLookup converterLookup) {
	this.converterLookup = converterLookup;
	if (converterLookup instanceof ConverterRegistry) {
		this.converterRegistry = (ConverterRegistry) converterLookup;
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:13,代码来源:XStreamMarshaller.java

示例11: marshal

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
public void marshal(HierarchicalStreamWriter writer, Object obj,
    ConverterLookup converterLookup, Mapper mapper, DataHolder dataHolder) {
    if (marshaller == null) {
        marshaller = new ReferenceByIdMarshaller(writer, converterLookup, mapper);
    }
    marshaller.start(obj, dataHolder);
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:8,代码来源:MultipleObjectsInOneStreamTest.java

示例12: unmarshal

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
public Object unmarshal(Object root, HierarchicalStreamReader reader,
    DataHolder dataHolder, ConverterLookup converterLookup, Mapper mapper) {
    if (unmarshaller == null) {
        unmarshaller = new ReferenceByIdUnmarshaller(
            root, reader, converterLookup, mapper);
    }
    return unmarshaller.start(dataHolder);
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:9,代码来源:MultipleObjectsInOneStreamTest.java

示例13: createUnmarshallingContext

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
@Override
protected ReferenceByXPathUnmarshaller createUnmarshallingContext(Object root,
                                                                  HierarchicalStreamReader reader,
                                                                  ConverterLookup converterLookup,
                                                                  Mapper mapper) {

    assertNull("strategy can only make one unmarshaller", requestedUnmarshaller);
    requestedUnmarshaller = (ReferenceByXPathUnmarshaller) super.createUnmarshallingContext(root, reader, converterLookup, mapper);
    return requestedUnmarshaller;
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:11,代码来源:ReferenceByXPathMarshallingStrategyTest.java

示例14: createMarshallingContext

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
@Override
protected ReferenceByXPathMarshaller createMarshallingContext(HierarchicalStreamWriter writer,
                                                              ConverterLookup converterLookup,
                                                              Mapper mapper) {

    assertNull("strategy can only make one marshaller", requestedMarshaller);
    requestedMarshaller = (ReferenceByXPathMarshaller) super.createMarshallingContext(writer, converterLookup, mapper);
    return requestedMarshaller;
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:10,代码来源:ReferenceByXPathMarshallingStrategyTest.java

示例15: TreeUnmarshaller

import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
public TreeUnmarshaller(Object paramObject, HierarchicalStreamReader paramHierarchicalStreamReader, ConverterLookup paramConverterLookup, Mapper paramMapper)
{
  this.root = paramObject;
  this.reader = paramHierarchicalStreamReader;
  this.converterLookup = paramConverterLookup;
  this.mapper = paramMapper;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:8,代码来源:TreeUnmarshaller.java


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