Java 类org.apache.camel.component.gson.GsonDataFormat 实例源码

项目:Camel    文件:GsonDataFormatAutoConfiguration.java   
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(GsonDataFormat.class)
public GsonDataFormat configureGsonDataFormat(CamelContext camelContext,
        GsonDataFormatConfiguration configuration) throws Exception {
    GsonDataFormat dataformat = new GsonDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
项目:spring-camel    文件:ProjetosRouter.java   
@Override
public void configure() throws Exception {

    DataFormat json = new GsonDataFormat(Projeto.class);

    from("activemq:queue:projetos")
        .id("activemq-route")
        .log("Recebendo mensagem da fila 'projetos': ${in.body}")
        .choice()
            .when(body().isInstanceOf(String.class))
                .unmarshal(json)
                .bean(this.processor, "processaPojo")
            .when(body().isInstanceOf(Map.class))
                .bean(this.processor, "processaMap")
            .otherwise()
                .bean(this.processor, "processaTexto");

}
项目:openex-worker    文件:SchedulerExecutor.java   
@Override
public ImmutableMap<String, Object> beans() {
    return ImmutableMap.of("json-gson", new GsonDataFormat());
}