Package org.milyn.payload

Examples of org.milyn.payload.JavaSource


            if(result != null) {
                JavaResult javaResult = (JavaResult) result;
                beanMap = javaResult.getResultMap();
            }
            if(source instanceof JavaSource) {
                JavaSource javaSource = (JavaSource) source;
                Map<String, Object> sourceBeans = javaSource.getBeans();

                if(sourceBeans != null) {
                    if(beanMap != null) {
                        beanMap.putAll(sourceBeans);
                    } else {
View Full Code Here


        Map<String, Object> myBeans = new HashMap<String, Object>();
        MyBean myBean = new MyBean();
        myBean.setX("xxxxxxx");
        myBeans.put("myBeanData", myBean);

        JavaSource source = new JavaSource(myBeans);
        source.setEventStreamRequired(false);

        // Create the output writer for the transform and run it...
        StringWriter myTransformResult = new StringWriter();
        smooks.filterSource(smooks.createExecutionContext(), source, new StreamResult(myTransformResult));
View Full Code Here

  }
 
  @Converter
  public static Source getSource(final Customer customer)
  {
      JavaSource javaSource = new JavaSource(customer);
      return javaSource;
  }
View Full Code Here

        Map<String, Object> myBeans = new HashMap<String, Object>();
        MyBean myBean = new MyBean();
        myBean.setX("xxxxxxx");
        myBeans.put("myBeanData", myBean);

        JavaSource source = new JavaSource(myBeans);
        source.setEventStreamRequired(false);

        // Create the output writer for the transform and run it...
        StringWriter myTransformResult = new StringWriter();
        smooks.filterSource(smooks.createExecutionContext(), source, new StreamResult(myTransformResult));
View Full Code Here

*/
public class MILYN_347_Test extends TestCase {

    public void test() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks.xml"));
        JavaSource source = new JavaSource("x", "XValObject");
        JavaResult result = new JavaResult();

        smooks.filterSource(source, result);

        assertEquals("{xxxx=XValObject}", result.getBean("bean").toString());
View Full Code Here

        rootObj.getEnums().add(new TheEnumContainer());

        Smooks smooks = new Smooks();
        StringResult res = new StringResult();

        smooks.filterSource(new JavaSource(rootObj), res);

        String expected = StreamUtils.readStreamAsString(getClass().getResourceAsStream("expected.xml"));
        XMLUnit.setIgnoreWhitespace(true);
        XMLAssert.assertXMLEqual(expected, res.getResult());
    }
View Full Code Here

        } else if (from instanceof Source) {
            source = (Source) from;
        } else if (from instanceof byte[]) {
            source = new StreamSource(new ByteArrayInputStream((byte[]) from));
        } else {
            source = new JavaSource(from);
        }
        return source;
    }
View Full Code Here

     * @param toStream The output stream that will be written to.
     */
    public void marshal(final Exchange exchange, final Object fromBody, final OutputStream toStream) throws Exception {
        final ExecutionContext execContext = smooks.createExecutionContext();
        final TypeConverter typeConverter = exchange.getContext().getTypeConverter();
        final JavaSource source = typeConverter.mandatoryConvertTo(JavaSource.class, exchange, fromBody);
        final StringResult stringResult = new StringResult();
        smooks.filterSource(execContext, source, stringResult);

        toStream.write(stringResult.getResult().getBytes(execContext.getContentEncoding()));
    }
View Full Code Here

    }

    @Converter
    public static JavaSource toJavaSource(Object payload)
    {
        return new JavaSource(payload);
    }
View Full Code Here

    }

    @Converter
    public static JavaSource toJavaSource(JavaResult result)
    {
        return new JavaSource(result.getResultMap().values());
    }
View Full Code Here

TOP

Related Classes of org.milyn.payload.JavaSource

Copyright © 2018 www.massapicom. 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.