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


Java PureJavaReflectionProvider类代码示例

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


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

示例1: load

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
public static void load( File folder ) {
	
	if (!folder.isDirectory())
		folder = folder.getParentFile();
	
	TweedSettings.folder = folder;
	
	try {
		
		File def = new File( folder, "tweed.xml" );
		
		if (!def.exists())
			settings = new TweedSettings();
		else
			settings = (TweedSettings) new XStream(new PureJavaReflectionProvider()).fromXML( def );
		
		TweedFrame.instance.tweed.initFrom( folder.toString() );
		
	} catch ( Throwable th ) {
		settings = new TweedSettings();
		save(true);
		th.printStackTrace();
	}
	
	writeRecentFiles();
}
 
开发者ID:twak,项目名称:chordatlas,代码行数:27,代码来源:TweedSettings.java

示例2: testSortsFieldOrderWithArray

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
public void testSortsFieldOrderWithArray() {

		SortableFieldKeySorter sorter = new SortableFieldKeySorter();
		sorter.registerFieldOrder(MommyBear.class,
				new String[] { "b", "c", "a" });

		xstream = new XStream(new PureJavaReflectionProvider(new FieldDictionary(sorter)));
		setupSecurity(xstream);
		xstream.alias("mommy", MommyBear.class);
		MommyBear root = new MommyBear();
		root.c = "ccc";
		root.b = "bbb";
		root.a = "aaa";
		assertBothWays(root, "<mommy>\n" + "  <b>bbb</b>\n" + "  <c>ccc</c>\n"
				+ "  <a>aaa</a>\n" + "</mommy>");
	}
 
开发者ID:x-stream,项目名称:xstream,代码行数:17,代码来源:SortableFieldListTest.java

示例3: testSortsFieldOrderWhileUsingInheritance

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
public void testSortsFieldOrderWhileUsingInheritance() {

		SortableFieldKeySorter sorter = new SortableFieldKeySorter();
		sorter.registerFieldOrder(BabyBear.class,
				new String[] { "b", "d", "c", "a" });

		xstream = new XStream(new PureJavaReflectionProvider(new FieldDictionary(sorter)));
                setupSecurity(xstream);
		xstream.alias("baby", BabyBear.class);
		BabyBear root = new BabyBear();
		root.c = "ccc";
		root.b = "bbb";
		root.a = "aaa";
		root.d = "ddd";
		assertBothWays(root, "<baby>\n" + "  <b>bbb</b>\n" + "  <d>ddd</d>\n"
				+ "  <c>ccc</c>\n" + "  <a>aaa</a>\n" + "</baby>");
	}
 
开发者ID:x-stream,项目名称:xstream,代码行数:18,代码来源:SortableFieldListTest.java

示例4: initXStream

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
/**
 * @return
 */
private XStream initXStream(final Session session, final boolean nullifyPk)
{
  final XStream xstream = new XStream() {
    @Override
    protected MapperWrapper wrapMapper(final MapperWrapper next)
    {
      return new HibernateMapper(new HibernateCollectionsMapper(next));
    }
  };
  // Converter für die Hibernate-Collections
  xstream.registerConverter(new HibernateCollectionConverter(xstream.getConverterLookup()));
  xstream.registerConverter(
      new HibernateProxyConverter(xstream.getMapper(), new PureJavaReflectionProvider(), xstream.getConverterLookup()),
      XStream.PRIORITY_VERY_HIGH);
  xstream.setMarshallingStrategy(new XStreamMarshallingStrategy(XStreamMarshallingStrategy.RELATIVE));
  init(xstream);
  return xstream;
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:22,代码来源:HibernateXmlConverter.java

示例5: BeanXStreamConverter

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
@Inject
public BeanXStreamConverter(XStreamConfiguration configuration) {
  rp = new PureJavaReflectionProvider();
  Mapper dmapper = new DefaultMapper(this.getClass().getClassLoader());
  /*
   * Putting this here means only one conversion per thread may be active at
   * any one time, but since the conversion process is atomic this will not
   * matter unless the class is extended.
   */
  writerStack = new ThreadSafeWriterStack();


  /*
   * create a driver that wires into a standard driver, and updates the stack
   * position.
   */
  driver = new StackDriver(new XppDriver(), writerStack, configuration.getNameSpaces());
  /*
   * Create an interface class mapper that understands class hierarchy for
   * single items
   */
  for (XStreamConfiguration.ConverterSet c : MAPPER_SCOPES) {
    converterMap.put(c, configuration.getConverterConfig(c,rp,dmapper,driver,writerStack));
  }
}
 
开发者ID:inevo,项目名称:shindig-1.1-BETA5-incubating,代码行数:26,代码来源:BeanXStreamConverter.java

示例6: testOwnMapperChainCanBeRegistered

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的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")));
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:13,代码来源:CustomMapperTest.java

示例7: testExceptionThrownUponSerializationIfNotSupport

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
public void testExceptionThrownUponSerializationIfNotSupport() {
    xstream = new XStream(new PureJavaReflectionProvider());
    xstream.alias("thing", ThingWithFinalField.class);

    try {
        xstream.toXML(new ThingWithFinalField());
    } catch (ObjectAccessException expectedException) {
        assertEquals("Invalid final field " + ThingWithFinalField.class.getName() + ".number",
                expectedException.getMessage());
    }
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:12,代码来源:FinalFieldsTest.java

示例8: testSerializeWithXppDriverAndPureJavaReflectionProviderAndActiveSecurityManager

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
public void testSerializeWithXppDriverAndPureJavaReflectionProviderAndActiveSecurityManager() {
    sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.misc"));
    sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.text.resources"));
    sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.util.resources"));
    sm.addPermission(source, new RuntimePermission("accessDeclaredMembers"));
    sm.addPermission(source, new RuntimePermission("createClassLoader"));
    sm.addPermission(source, new RuntimePermission("fileSystemProvider"));
    sm.addPermission(source, new RuntimePermission("loadLibrary.nio"));
    sm.addPermission(source, new RuntimePermission("modifyThreadGroup"));
    sm.addPermission(source, new PropertyPermission("ibm.dst.compatibility", "read"));
    sm.addPermission(source, new PropertyPermission("java.home", "read"));
    sm.addPermission(source, new PropertyPermission("java.nio.file.spi.DefaultFileSystemProvider", "read"));
    sm.addPermission(source, new PropertyPermission("java.security.debug", "read"));
    sm.addPermission(source, new PropertyPermission("javax.xml.datatype.DatatypeFactory", "read"));
    sm.addPermission(source, new PropertyPermission("jaxp.debug", "read"));
    sm.addPermission(source, new PropertyPermission("jdk.util.TimeZone.allowSetDefault", "read"));
    sm.addPermission(source, new PropertyPermission("sun.boot.class.path", "read"));
    sm.addPermission(source, new PropertyPermission("sun.io.serialization.extendedDebugInfo", "read"));
    sm.addPermission(source, new PropertyPermission("sun.nio.fs.chdirAllowed", "read"));
    sm.addPermission(source, new PropertyPermission("sun.timezone.ids.oldmapping", "read"));
    sm.addPermission(source, new PropertyPermission("user.country", "read"));
    sm.addPermission(source, new PropertyPermission("user.dir", "read"));
    sm.addPermission(source, new PropertyPermission("user.timezone", "read,write"));
    sm.addPermission(source, new ReflectPermission("suppressAccessChecks"));
    sm.addPermission(source, new NetPermission("specifyStreamHandler"));
    sm.setReadOnly();
    System.setSecurityManager(sm);

    xstream = new XStream(new PureJavaReflectionProvider());
    xstream.allowTypesByWildcard(AbstractAcceptanceTest.class.getPackage().getName()+".*objects.**");
    xstream.allowTypesByWildcard(this.getClass().getName()+"$*");

    assertBothWays();
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:35,代码来源:SecurityManagerTest.java

示例9: testCanWriteInheritanceHierarchiesInOldOrder

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
public void testCanWriteInheritanceHierarchiesInOldOrder() {
    xstream = new XStream(new PureJavaReflectionProvider(new FieldDictionary(new XStream12FieldKeySorter())));
    OpenSourceSoftware openSourceSoftware = new OpenSourceSoftware("apache", "geronimo", "license");
    String xml =
            "<oss>\n" +
            "  <license>license</license>\n" +
            "  <vendor>apache</vendor>\n" +
            "  <name>geronimo</name>\n" +
            "</oss>";

    xstream.alias("oss", OpenSourceSoftware.class);
    assertEquals(xml, xstream.toXML(openSourceSoftware));
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:14,代码来源:XStream12CompatibilityTest.java

示例10: setUp

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
protected void setUp() throws Exception {
    super.setUp();
    // fonts should be serializable also with pure Java
    xstream = new XStream(new PureJavaReflectionProvider());
    xstream.allowTypes(Font.class, TextAttribute.class);
    in = new Font("Arial", Font.BOLD, 20);
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:8,代码来源:FontConverterTest.java

示例11: saveXML

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
public static void saveXML( Object o , String fileName ) {
		BoofcvClassLoader loader = new BoofcvClassLoader();
		XStreamAppletVersion xstream = new XStreamAppletVersion(new PureJavaReflectionProvider(),new DomDriver(),loader,null,new DefaultConverterLookup(), null);
//		XStream xstream = new XStream(new PureJavaReflectionProvider(),new DomDriver(),loader,null,new DefaultConverterLookup(), null);
		xstream.registerConverter(new JavaBeanConverter(xstream.getMapper()));

		try {
			xstream.toXML(o,new FileOutputStream(fileName));
		} catch (FileNotFoundException e) {
			throw new RuntimeException(e);
		}
	}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:13,代码来源:BoofMiscOps.java

示例12: loadXML

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
public static <T> T loadXML( String fileName ) {

		BoofcvClassLoader loader = new BoofcvClassLoader();
		XStreamAppletVersion xstream = new XStreamAppletVersion(new PureJavaReflectionProvider(),new DomDriver(),loader,null,new DefaultConverterLookup(), null);
		xstream.registerConverter(new JavaBeanConverter(xstream.getMapper()));
		try {
			return (T)xstream.fromXML(new FileReader(fileName));
		} catch (FileNotFoundException e) {
			throw new RuntimeException(e);
		}
	}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:12,代码来源:BoofMiscOps.java

示例13: VRaptorXStream

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
public VRaptorXStream(TypeNameExtractor extractor, HierarchicalStreamDriver hierarchicalStreamDriver, 
		Serializee serializee, ReflectionProvider reflectionProvider) {
	super(new PureJavaReflectionProvider(),hierarchicalStreamDriver);
	this.extractor = extractor;
	this.serializee = serializee;
	this.reflectionProvider = reflectionProvider;
}
 
开发者ID:caelum,项目名称:vraptor4,代码行数:8,代码来源:VRaptorXStream.java

示例14: createXStream

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
protected XStream createXStream() {
    XStream xstream = new XStream(new PureJavaReflectionProvider(new FieldDictionary(
        new AlphabeticalFieldkeySorter())));
    setupSecurity(xstream);
    return xstream;
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:7,代码来源:CustomFieldKeySorterTest.java

示例15: testSerializeWithDomDriverAndPureJavaReflectionProviderAndActiveSecurityManager

import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; //导入依赖的package包/类
public void testSerializeWithDomDriverAndPureJavaReflectionProviderAndActiveSecurityManager() {
    sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.text.resources"));
    sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.util.resources"));
    sm.addPermission(source, new RuntimePermission("accessDeclaredMembers"));
    sm.addPermission(source, new RuntimePermission("createClassLoader"));
    sm.addPermission(source, new RuntimePermission("fileSystemProvider"));
    sm.addPermission(source, new RuntimePermission("loadLibrary.nio"));
    sm.addPermission(source, new RuntimePermission("modifyThreadGroup"));
    sm.addPermission(source, new RuntimePermission("reflectionFactoryAccess"));
    sm.addPermission(source, new PropertyPermission("com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration", "read"));
    sm.addPermission(source, new PropertyPermission("elementAttributeLimit", "read"));
    sm.addPermission(source, new PropertyPermission("entityExpansionLimit", "read"));
    sm.addPermission(source, new PropertyPermission("http://java.sun.com/xml/dom/properties/ancestor-check", "read"));
    sm.addPermission(source, new PropertyPermission("ibm.dst.compatibility", "read"));
    sm.addPermission(source, new PropertyPermission("java.home", "read"));
    sm.addPermission(source, new PropertyPermission("java.nio.file.spi.DefaultFileSystemProvider", "read"));
    sm.addPermission(source, new PropertyPermission("java.security.debug", "read"));
    sm.addPermission(source, new PropertyPermission("javax.xml.datatype.DatatypeFactory", "read"));
    sm.addPermission(source, new PropertyPermission("javax.xml.parsers.DocumentBuilderFactory", "read"));
    sm.addPermission(source, new PropertyPermission("javax.xml.accessExternalDTD", "read"));
    sm.addPermission(source, new PropertyPermission("javax.xml.accessExternalSchema", "read"));
    sm.addPermission(source, new PropertyPermission("jaxp.debug", "read"));
    sm.addPermission(source, new PropertyPermission("jdk.util.TimeZone.allowSetDefault", "read"));
    sm.addPermission(source, new PropertyPermission("jdk.xml.elementAttributeLimit", "read"));
    sm.addPermission(source, new PropertyPermission("jdk.xml.entityExpansionLimit", "read"));
    sm.addPermission(source, new PropertyPermission("jdk.xml.entityReplacementLimit", "read"));
    sm.addPermission(source, new PropertyPermission("jdk.xml.maxElementDepth", "read"));
    sm.addPermission(source, new PropertyPermission("jdk.xml.maxGeneralEntitySizeLimit", "read"));
    sm.addPermission(source, new PropertyPermission("jdk.xml.maxParameterEntitySizeLimit", "read"));
    sm.addPermission(source, new PropertyPermission("jdk.xml.maxOccurLimit", "read"));
    sm.addPermission(source, new PropertyPermission("jdk.xml.maxXMLNameLimit", "read"));
    sm.addPermission(source, new PropertyPermission("jdk.xml.totalEntitySizeLimit", "read"));
    sm.addPermission(source, new PropertyPermission("maxOccurLimit", "read"));
    sm.addPermission(source, new PropertyPermission("sun.boot.class.path", "read"));
    sm.addPermission(source, new PropertyPermission("sun.nio.fs.chdirAllowed", "read"));
    sm.addPermission(source, new PropertyPermission("sun.timezone.ids.oldmapping", "read"));
    sm.addPermission(source, new PropertyPermission("user.country", "read"));
    sm.addPermission(source, new PropertyPermission("user.dir", "read"));
    sm.addPermission(source, new PropertyPermission("user.timezone", "read,write"));
    sm.addPermission(source, new NetPermission("specifyStreamHandler"));
    sm.addPermission(source, new ReflectPermission("suppressAccessChecks"));
    sm.setReadOnly();
    System.setSecurityManager(sm);

    xstream = new XStream(new PureJavaReflectionProvider(), new DomDriver());
    xstream.allowTypesByWildcard(AbstractAcceptanceTest.class.getPackage().getName()+".*objects.**");
    xstream.allowTypesByWildcard(this.getClass().getName()+"$*");

    assertBothWays();
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:51,代码来源:SecurityManagerTest.java


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