Package com.thoughtworks.xstream

Examples of com.thoughtworks.xstream.XStream.processAnnotations()


    //@Test
    public void addingRendezvousMessages1() throws DbException, XQueryException {
        XStream xstream = new XStream();
        XBirdCollectionStrategy<String, Object> strategy = new XBirdCollectionStrategy<String, Object>(COLLECTION_NAME, xstream);
        xstream.processAnnotations(RendezvousMessage.class);

        RendezvousMessage msg1 = new RendezvousMessage(15, Arrays.asList(new Author("anonymous"), new Author("makoto")));
        System.out.println(xstream.toXML(msg1));
        System.out.println();
View Full Code Here


    //@Test
    public void addingRendezvousMessages2() throws DbException, XQueryException {
        XStream xstream = new XStream();
        XBirdCollectionStrategy<String, Object> strategy = new XBirdCollectionStrategy<String, Object>(COLLECTION_NAME, xstream);
        xstream.processAnnotations(RendezvousMessage.class);
        xstream.processAnnotations(Author.class);

        List<Author> author1 = Arrays.asList(new Author("anonymous"));
        RendezvousMessage msg1 = new RendezvousMessage(15, author1);
        System.out.println(xstream.toXML(msg1));
View Full Code Here

    //@Test
    public void addingRendezvousMessages2() throws DbException, XQueryException {
        XStream xstream = new XStream();
        XBirdCollectionStrategy<String, Object> strategy = new XBirdCollectionStrategy<String, Object>(COLLECTION_NAME, xstream);
        xstream.processAnnotations(RendezvousMessage.class);
        xstream.processAnnotations(Author.class);

        List<Author> author1 = Arrays.asList(new Author("anonymous"));
        RendezvousMessage msg1 = new RendezvousMessage(15, author1);
        System.out.println(xstream.toXML(msg1));
        System.out.println();
View Full Code Here

            if (request == null) {
                AbstractSObjectBase sObject = in.getBody(AbstractSObjectBase.class);
                if (sObject != null) {
                    // marshall the SObject
                    // first process annotations on the class, for things like alias, etc.
                    localXStream.processAnnotations(sObject.getClass());
                    ByteArrayOutputStream out = new ByteArrayOutputStream();
                    // make sure we write the XML with the right encoding
                    localXStream.toXML(sObject, new OutputStreamWriter(out, StringUtil.__UTF8_CHARSET));
                    request = new ByteArrayInputStream(out.toByteArray());
                } else {
View Full Code Here

            if (responseEntity != null) {
                final Class<?> responseClass = exchange.getProperty(RESPONSE_CLASS, Class.class);
                Object response;
                if (responseClass != null) {
                    // its ok to call this multiple times, as xstream ignores duplicate calls
                    localXStream.processAnnotations(responseClass);
                    final String responseAlias = exchange.getProperty(RESPONSE_ALIAS, String.class);
                    if (responseAlias != null) {
                        // extremely dirty, need to flush entire cache if its holding on to an old alias!!!
                        final CachingMapper mapper = (CachingMapper) localXStream.getMapper();
                        try {
View Full Code Here

     */
    public static XStreamDataFormat processAnnotations(Iterable<Class<?>> types) {
        XStreamDataFormat answer = new XStreamDataFormat();
        XStream xstream = answer.getXStream();
        for (Class<?> type : types) {
            xstream.processAnnotations(type);
        }
        return answer;
    }

    /**
 
View Full Code Here

     */
    public static XStreamDataFormat processAnnotations(Class<?>... types) {
        XStreamDataFormat answer = new XStreamDataFormat();
        XStream xstream = answer.getXStream();
        for (Class<?> type : types) {
            xstream.processAnnotations(type);
        }
        return answer;
    }

    public void marshal(Exchange exchange, Object body, OutputStream stream) throws Exception {
View Full Code Here

        //ElementNames names = new JsonElementNames();

        //XStream xstream = new XStream( new JettisonMappedXmlDriver() );      
        XStream xstream = new XStream();
        //xstream.setMode( XStream.NO_REFERENCES );
        xstream.processAnnotations( BatchExecutionImpl.class );
        xstream.addImplicitCollection( BatchExecutionImpl.class,
                                       "commands" );

        xstream.alias( "batch-execution",
                       BatchExecutionImpl.class );
View Full Code Here

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;
    }

    private XStream xStream;
    private SolverConfig solverConfig = null;
View Full Code Here

     */
    public static XStreamDataFormat processAnnotations(Iterable<Class<?>> types) {
        XStreamDataFormat answer = new XStreamDataFormat();
        XStream xstream = answer.getXStream();
        for (Class<?> type : types) {
            xstream.processAnnotations(type);
        }
        return answer;
    }

    /**
 
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.