public Result createResult( final ResultType type ) { Result result = null; switch ( type ) { case STRING: result = new StringResult(); break; case BYTES: result = new ByteResult(); break; case JAVA: result = new JavaResult(true); break; case NORESULT: break; default: result = null; break; } return result; } }
public Result createResult( final ResultType type ) { Result result = null; switch ( type ) { case STRING: result = new StringResult(); break; case BYTES: result = new ByteResult(); break; case JAVA: result = new JavaResult(true); break; case NORESULT: break; default: result = null; break; } return result; } }
public Result createResult( final ResultType type ) { Result result = null; switch ( type ) { case STRING: result = new StringResult(); break; case BYTES: result = new ByteResult(); break; case JAVA: result = new JavaResult(true); break; case NORESULT: break; default: result = null; break; } return result; } }
public Result createResult( final ResultType type ) { Result result = null; switch ( type ) { case STRING: result = new StringResult(); break; case BYTES: result = new ByteResult(); break; case JAVA: result = new JavaResult(); break; case NORESULT: break; default: result = null; break; } return result; } }
/** * Marshals the Object 'fromBody' to an OutputStream 'toStream' * </p> * <p/> * The Camel framework will call this method from {@link MarshalProcessor#process(Exchange)} * and it will take care of setting the Out Message's body to the bytes written to the toStream * OutputStream. * * @param exchange The Camel {@link Exchange}. * @param fromBody The object to be marshalled into the output stream. * @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())); }