本文整理汇总了Java中com.thoughtworks.xstream.converters.ConverterLookup类的典型用法代码示例。如果您正苦于以下问题:Java ConverterLookup类的具体用法?Java ConverterLookup怎么用?Java ConverterLookup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConverterLookup类属于com.thoughtworks.xstream.converters包,在下文中一共展示了ConverterLookup类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: HibernateCollectionConverter
import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
public HibernateCollectionConverter(ConverterLookup converterLookup)
{
listSetConverter = converterLookup.lookupConverterForType(ArrayList.class);
mapConverter = converterLookup.lookupConverterForType(HashMap.class);
treeMapConverter = converterLookup.lookupConverterForType(TreeMap.class);
treeSetConverter = converterLookup.lookupConverterForType(TreeSet.class);
defaultConverter = converterLookup.lookupConverterForType(Object.class);
}
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:9,代码来源:HibernateCollectionConverter.java
示例17: getDefaultConverterLookup
import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
private ConverterLookup getDefaultConverterLookup()
{
return getConverterLookup();
}
开发者ID:equella,项目名称:Equella,代码行数:5,代码来源:TLEXStream.java
示例18: getConverterLookup
import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
protected ConverterLookup getConverterLookup() {
return xstream.getConverterLookup();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:AbstractFilePersistenceStrategy.java
示例19: NamedMapConverter
import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
/**
* Constructs a NamedMapConverter with attribute support handling an explicit Map type.
*
* @param type the Map type this instance will handle
* @param mapper the mapper
* @param entryName the name of the entry elements
* @param keyName the name of the key elements
* @param keyType the base type of key elements
* @param valueName the name of the value elements
* @param valueType the base type of value elements
* @param keyAsAttribute flag to write key as attribute of entry element
* @param valueAsAttribute flag to write value as attribute of entry element
* @param lookup used to lookup SingleValueConverter for attributes
* @since 1.4.5
*/
public NamedMapConverter(
@SuppressWarnings("rawtypes") final Class<? extends Map> type, final Mapper mapper, final String entryName,
final String keyName, final Class<?> keyType, final String valueName, final Class<?> valueType,
final boolean keyAsAttribute, final boolean valueAsAttribute, final ConverterLookup lookup) {
super(mapper, type);
this.entryName = entryName != null && entryName.length() == 0 ? null : entryName;
this.keyName = keyName != null && keyName.length() == 0 ? null : keyName;
this.keyType = keyType;
this.valueName = valueName != null && valueName.length() == 0 ? null : valueName;
this.valueType = valueType;
this.keyAsAttribute = keyAsAttribute;
this.valueAsAttribute = valueAsAttribute;
this.lookup = lookup;
enumMapper = UseAttributeForEnumMapper.createEnumMapper(mapper);
if (keyType == null || valueType == null) {
throw new IllegalArgumentException("Class types of key and value are mandatory");
}
if (entryName == null) {
if (keyAsAttribute || valueAsAttribute) {
throw new IllegalArgumentException("Cannot write attributes to map entry, if map entry must be omitted");
}
if (valueName == null) {
throw new IllegalArgumentException("Cannot write value as text of entry, if entry must be omitted");
}
}
if (keyName == null) {
throw new IllegalArgumentException("Cannot write key without name");
}
if (valueName == null) {
if (valueAsAttribute) {
throw new IllegalArgumentException("Cannot write value as attribute without name");
} else if (!keyAsAttribute) {
throw new IllegalArgumentException("Cannot write value as text of entry, if key is also child element");
}
}
if (keyAsAttribute && valueAsAttribute && keyName.equals(valueName)) {
throw new IllegalArgumentException("Cannot write key and value with same attribute name");
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:56,代码来源:NamedMapConverter.java
示例20: ThrowableConverter
import com.thoughtworks.xstream.converters.ConverterLookup; //导入依赖的package包/类
/**
* @since 1.4.5
*/
public ThrowableConverter(final ConverterLookup lookup) {
this.lookup = lookup;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:ThrowableConverter.java
注:本文中的com.thoughtworks.xstream.converters.ConverterLookup类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论