Examples of PureJavaReflectionProvider


Examples of com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider

    private XStream xStream;
    private SolverBenchmarkSuite suite = null;

    public XmlSolverBenchmarker() {
        // TODO From Xstream 1.3.3 that KeySorter will be the default. See http://jira.codehaus.org/browse/XSTR-363
        xStream = new XStream(new PureJavaReflectionProvider(new FieldDictionary(new NativeFieldKeySorter())));
        xStream.setMode(XStream.ID_REFERENCES);
        xStream.processAnnotations(SolverBenchmarkSuite.class);
        // It doesn't pick up the annotations of the @XStreamImplicit in xstream 1.2.2
        xStream.processAnnotations(SolverBenchmark.class);
    }
View Full Code Here

Examples of com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider

    private XStream xStream;
    private AbstractSolverConfig config = null;

    public XmlSolverConfigurer() {
        // TODO From Xstream 1.3.3 that KeySorter will be the default. See http://jira.codehaus.org/browse/XSTR-363
        xStream = new XStream(new PureJavaReflectionProvider(new FieldDictionary(new NativeFieldKeySorter())));
        xStream.setMode(XStream.ID_REFERENCES);
        xStream.processAnnotations(BruteForceSolverConfig.class);
        xStream.processAnnotations(LocalSearchSolverConfig.class);
    }
View Full Code Here

Examples of com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider

* @see SolverFactory
*/
public class XmlSolverFactory implements SolverFactory {

    public static XStream buildXstream() {
        XStream xStream = new XStream(new PureJavaReflectionProvider(new FieldDictionary(new NativeFieldKeySorter())));
        xStream.setMode(XStream.ID_REFERENCES);
        xStream.processAnnotations(SolverConfig.class);
        return xStream;
    }
View Full Code Here

Examples of com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider

                if (!Collection.class.isAssignableFrom(fieldType)) {
                    throw new ObjectAccessException("Field " + fieldName + " of " + result.getClass().getName() +
                            " is configured for an implicit Collection, but field is of type " + fieldType.getName());
                }
                if (pureJavaReflectionProvider == null) {
                    pureJavaReflectionProvider = new PureJavaReflectionProvider();
                }
                collection = (Collection)pureJavaReflectionProvider.newInstance(fieldType);
                reflectionProvider.writeField(result, fieldName, collection, null);
                implicitCollections.put(fieldName, collection);
            }
View Full Code Here

Examples of com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider

        assertNotNull(serialized);
        return serialized;
    }

    protected Object serializeWithXStreamAndPureReflection(Object toSerialize) {
        final XStream xstream = new XStream(new PureJavaReflectionProvider(), new XppDriver());
        final String xml = xstream.toXML(toSerialize);
        Object serialized = xstream.fromXML(xml);
        assertNotNull(serialized);
        return serialized;
    }
View Full Code Here

Examples of com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider

  protected Map<XStreamConfiguration.ConverterSet, XStreamConfiguration.ConverterConfig> converterMap = Maps.newHashMap();

  @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.
View Full Code Here

Examples of com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider

  /**
   * Creates a PureJavaXStreamComponentInstanceFactory
   * using an instance of XStream in PureJava mode.
   */
  public PureJavaXStreamComponentInstanceFactory(){
    super(new XStream(new PureJavaReflectionProvider()));
  }
View Full Code Here

Examples of com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider

public class UserConverter extends com.thoughtworks.xstream.converters.reflection.ReflectionConverter
{

    public UserConverter(Mapper m)
  {
      super(m, new PureJavaReflectionProvider());
  }
View Full Code Here

Examples of com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider

        assertEquals("world", childA.getChildStuff().get("hello"));
        assertEquals("foo", childA.getParentStuff().iterator().next());
    }

    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" +
View Full Code Here

Examples of com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider

    protected void setUp() throws Exception {
        super.setUp();
        xstream.alias("mbool", MultiBoolean.class);
        xstream.registerConverter(new ReflectionConverter(
            xstream.getMapper(), new PureJavaReflectionProvider()), XStream.PRIORITY_VERY_LOW);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.