本文整理汇总了Java中com.thoughtworks.xstream.core.ClassLoaderReference类的典型用法代码示例。如果您正苦于以下问题:Java ClassLoaderReference类的具体用法?Java ClassLoaderReference怎么用?Java ClassLoaderReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClassLoaderReference类属于com.thoughtworks.xstream.core包,在下文中一共展示了ClassLoaderReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: XStream
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的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);
}
});
}
示例2: AnnotationMapper
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的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)};
}
示例3: setUp
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的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);
}
示例4: XStream
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的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);
}
示例5: getInstance
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的package包/类
public static CustomObjectInputStream getInstance(DataHolder paramDataHolder, StreamCallback paramStreamCallback, ClassLoaderReference paramClassLoaderReference)
{
try
{
CustomObjectInputStream localCustomObjectInputStream1 = (CustomObjectInputStream)paramDataHolder.get(DATA_HOLDER_KEY);
CustomObjectInputStream localCustomObjectInputStream2 = localCustomObjectInputStream1;
if (localCustomObjectInputStream1 == null)
{
localCustomObjectInputStream2 = new CustomObjectInputStream(paramStreamCallback, paramClassLoaderReference);
paramDataHolder.put(DATA_HOLDER_KEY, localCustomObjectInputStream2);
}
else
{
localCustomObjectInputStream2.pushCallback(paramStreamCallback);
}
return localCustomObjectInputStream2;
}
catch (IOException localIOException)
{
throw new ConversionException("Cannot create CustomObjectStream", localIOException);
}
finally
{
}
}
示例6: AnnotationMapper
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的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)};
}
示例7: readObject
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的package包/类
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
setupMappers();
final int max = in.readInt();
arguments = new Object[max + 2];
for (int i = 0; i < max; i++) {
arguments[i] = in.readObject();
if (arguments[i] instanceof ClassLoaderReference) {
arguments[max + 1] = ((ClassLoaderReference)arguments[i]).getReference();
}
}
arguments[max] = new JVM();
}
示例8: getInstance
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的package包/类
public static synchronized CustomObjectInputStream getInstance(final DataHolder whereFrom,
final CustomObjectInputStream.StreamCallback callback, final ClassLoaderReference classLoaderReference) {
try {
CustomObjectInputStream result = (CustomObjectInputStream)whereFrom.get(DATA_HOLDER_KEY);
if (result == null) {
result = new CustomObjectInputStream(callback, classLoaderReference);
whereFrom.put(DATA_HOLDER_KEY, result);
} else {
result.pushCallback(callback);
}
return result;
} catch (final IOException e) {
throw new ConversionException("Cannot create CustomObjectStream", e);
}
}
示例9: CustomObjectInputStream
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的package包/类
/**
* Warning, this object is expensive to create (due to functionality inherited from superclass). Use the static
* fetch() method instead, wherever possible.
*
* @see #getInstance(DataHolder, StreamCallback, ClassLoaderReference)
*/
public CustomObjectInputStream(final StreamCallback callback, final ClassLoaderReference classLoaderReference)
throws IOException, SecurityException {
super();
callbacks.push(callback);
this.classLoaderReference = classLoaderReference;
}
示例10: CubaXStream
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的package包/类
public CubaXStream(List<Class> excluded) {
this(null,
new XppDriver(),
new ClassLoaderReference(Thread.currentThread().getContextClassLoader()),
null,
new CubaXStreamConverterLookup(excluded));
}
示例11: createStringPlan
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的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);
}
示例12: CustomObjectInputStream
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的package包/类
/**
* Warning, this object is expensive to create (due to functionality inherited from superclass). Use the static
* fetch() method instead, wherever possible.
*
* @see #getInstance(DataHolder, StreamCallback, ClassLoaderReference)
*/
public CustomObjectInputStream(final StreamCallback callback, final ClassLoaderReference classLoaderReference)
throws IOException, SecurityException {
super();
callbacks.push(callback);
this.classLoaderReference = classLoaderReference;
}
示例13: testOwnMapperChainCanBeRegistered
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的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")));
}
示例14: readObject
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的package包/类
private void readObject(ObjectInputStream paramObjectInputStream)
{
paramObjectInputStream.defaultReadObject();
setupMappers();
int i = paramObjectInputStream.readInt();
this.arguments = new Object[i + 2];
for (int j = 0; j < i; j++)
{
this.arguments[j] = paramObjectInputStream.readObject();
if ((this.arguments[j] instanceof ClassLoaderReference))
this.arguments[(i + 1)] = ((ClassLoaderReference)this.arguments[j]).getReference();
}
this.arguments[i] = new JVM();
}
示例15: getXStream
import com.thoughtworks.xstream.core.ClassLoaderReference; //导入依赖的package包/类
private static XStream getXStream() {
XStream xstream = new XStream(null, new XppDriver(),new ClassLoaderReference(MyDBI.class.getClassLoader()));
xstream.omitField(MyDBI.class, "conn");
xstream.omitField(MyDBI.class, "dbUsername");
xstream.omitField(MyDBI.class, "dbPassword");
xstream.omitField(MyDBI.class, "dbPath");
xstream.omitField(MyDBI.class, "path2XmlFile");
xstream.omitField(MyDBI.class, "isServerConnection");
xstream.omitField(MyDBI.class, "isAdminConnection");
xstream.omitField(MyDBI.class, "passFalse");
xstream.omitField(MyDBI.class, "filledHashtables");
xstream.omitField(MyDBTablesNew.class, "isPmm");
xstream.omitField(MyDBTablesNew.class, "isKrise");
xstream.omitField(MyDBTablesNew.class, "isSiLeBAT");
//xstream.omitField(MyTable.class, "rowHeights");
xstream.omitField(MyTable.class, "colWidths");
xstream.omitField(MyTable.class, "sortKeyList");
xstream.omitField(MyTable.class, "searchString");
xstream.omitField(MyTable.class, "selectedRow");
xstream.omitField(MyTable.class, "selectedCol");
xstream.omitField(MyTable.class, "verticalScrollerPosition");
xstream.omitField(MyTable.class, "horizontalScrollerPosition");
xstream.omitField(MyTable.class, "form_SelectedID");
xstream.omitField(MyTable.class, "caller4Trigger");
xstream.omitField(MyTable.class, "mnSQL");
return xstream;
}