本文整理汇总了Java中com.thoughtworks.xstream.converters.reflection.ReflectionProvider类的典型用法代码示例。如果您正苦于以下问题:Java ReflectionProvider类的具体用法?Java ReflectionProvider怎么用?Java ReflectionProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReflectionProvider类属于com.thoughtworks.xstream.converters.reflection包,在下文中一共展示了ReflectionProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ToAttributedValueConverter
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的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);
}
示例2: XStream
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的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);
}
});
}
示例3: IdentifiableToIdConverter
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的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);
}
}
示例4: AnnotationMapper
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的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)};
}
示例5: XStream
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的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);
}
示例6: AnnotationMapper
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的package包/类
/**
* Construct an AnnotationMapper.
*
* @param wrapped the next {@link com.thoughtworks.xstream.mapper.Mapper} in the chain
* @since 1.3
*/
public AnnotationMapper(
final Mapper wrapped, final ConverterRegistry converterRegistry, final ConverterLookup converterLookup,
final XStreamClassLoader classLoader, final ReflectionProvider reflectionProvider,
final JVM jvm) {
super(wrapped);
this.converterRegistry = converterRegistry;
annotatedTypes.add(Object.class);
classAliasingMapper = (ClassAliasingMapper) lookupMapperOfType(ClassAliasingMapper.class);
defaultImplementationsMapper = (DefaultImplementationsMapper) lookupMapperOfType(DefaultImplementationsMapper.class);
implicitCollectionMapper = (ImplicitCollectionMapper) lookupMapperOfType(ImplicitCollectionMapper.class);
fieldAliasingMapper = (FieldAliasingMapper) lookupMapperOfType(FieldAliasingMapper.class);
attributeMapper = (AttributeMapper) lookupMapperOfType(AttributeMapper.class);
localConversionMapper = (LocalConversionMapper) lookupMapperOfType(LocalConversionMapper.class);
locked = true;
arguments = new Object[]{this, classLoader, reflectionProvider, jvm, converterLookup};
}
示例7: ResourceMapper
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的package包/类
public ResourceMapper(Object jo_packages, boolean isCamel,
boolean useSingleQuote, boolean compatible, ReflectionProvider reflectionProvider) {
super(reflectionProvider);
if (jo_packages instanceof Map) {
this.jo_packages0 = (Map) jo_packages;
} else {
if (jo_packages instanceof String) {
this.jo_packages0 = new LinkedHashMap<String, String>();
this.jo_packages0.put((String)jo_packages, "");
}
}
jsonc = new JSONSerializer(compatible);
this.isCamel = isCamel;
this.useSingleQuote = useSingleQuote;
if (useSingleQuote) {
jsonc.Q = "'";
}
this.registerConverter(new RXConverter(this.getClassMapper()));
this.setupConverters();
}
示例8: XStream
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的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);
}
示例9: AnnotationMapper
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的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)};
}
示例10: bestReflectionProvider
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的package包/类
/**
* @deprecated As of 1.4.5 use {@link #newReflectionProvider()}
*/
@Deprecated
public synchronized ReflectionProvider bestReflectionProvider() {
if (reflectionProvider == null) {
reflectionProvider = newReflectionProvider();
}
return reflectionProvider;
}
示例11: CubaXStream
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的package包/类
protected CubaXStream(
ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver, ClassLoaderReference classLoader,
Mapper mapper, final CubaXStreamConverterLookup converterLookup) {
super(reflectionProvider, driver, classLoader, mapper,
converterLookup::lookupConverterForType,
converterLookup::registerConverter);
}
示例12: createInstance
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的package包/类
/**
* Returns a ReflectionProvider that provides core reflection services.
*
* @return configured reflection provider.
*/
@Override
protected final ReflectionProvider createInstance() {
SortableFieldKeySorter sorter = new SortableFieldKeySorter();
sorter.registerFieldOrder(TaxonName.class,
ReflectionProviderFactory.TAXON_NAME_FIELDS);
FieldDictionary fieldDictionary = new FieldDictionary(sorter);
ReflectionProvider reflectionProvider
= new Sun14ReflectionProvider(fieldDictionary);
return reflectionProvider;
}
示例13: AnnotationReflectionConverter
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的package包/类
@Deprecated
public AnnotationReflectionConverter(Mapper paramMapper, ReflectionProvider paramReflectionProvider, AnnotationProvider paramAnnotationProvider)
{
super(paramMapper, paramReflectionProvider);
this.annotationProvider = paramAnnotationProvider;
this.cachedConverters = new HashMap();
}
示例14: bestReflectionProvider
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的package包/类
public ReflectionProvider bestReflectionProvider()
{
try
{
if (this.reflectionProvider == null)
this.reflectionProvider = newReflectionProvider();
ReflectionProvider localReflectionProvider = this.reflectionProvider;
return localReflectionProvider;
}
finally
{
}
}
示例15: createXStream
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; //导入依赖的package包/类
public XStream createXStream(ReflectionProvider reflectionProvider) {
return new XStream(reflectionProvider, new DomDriver("UTF-8", new XmlFriendlyNameCoder("__","_"))) {
@Override
protected MapperWrapper wrapMapper(MapperWrapper next) {
return new ApiMapperWrapper(next, apiResponseType);
}
};
}