当前位置: 首页>>代码示例>>Java>>正文


Java IntrospectionSupport.setProperties方法代码示例

本文整理汇总了Java中org.apache.camel.util.IntrospectionSupport.setProperties方法的典型用法代码示例。如果您正苦于以下问题:Java IntrospectionSupport.setProperties方法的具体用法?Java IntrospectionSupport.setProperties怎么用?Java IntrospectionSupport.setProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.camel.util.IntrospectionSupport的用法示例。


在下文中一共展示了IntrospectionSupport.setProperties方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldPassSpecificationToRestSwaggerComponent

import org.apache.camel.util.IntrospectionSupport; //导入方法依赖的package包/类
@Test
public void shouldPassSpecificationToRestSwaggerComponent() throws Exception {
    final Component component = camelContext.getComponent("swagger-operation");
    assertThat(component).isNotNull();

    final String specification = IOUtils.toString(SwaggerConnectorComponentTest.class.getResource("/petstore.json"),
        StandardCharsets.UTF_8);
    IntrospectionSupport.setProperties(component, new HashMap<>(Collections.singletonMap("specification", specification)));

    final Endpoint endpoint = component.createEndpoint("swagger-operation://?operationId=addPet");
    assertThat(endpoint).isNotNull();

    final Optional<RestSwaggerEndpoint> maybeRestSwagger = camelContext.getEndpoints().stream()
        .filter(RestSwaggerEndpoint.class::isInstance).map(RestSwaggerEndpoint.class::cast).findFirst();

    assertThat(maybeRestSwagger).hasValueSatisfying(restSwagger -> {
        assertThat(restSwagger.getSpecificationUri()).isNotNull();
        assertThat(restSwagger.getOperationId()).isEqualTo("addPet");
    });
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:21,代码来源:SwaggerConnectorComponentTest.java

示例2: configureHttpComponent

import org.apache.camel.util.IntrospectionSupport; //导入方法依赖的package包/类
@Lazy
@Bean(name = "syndesis-http-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(HttpComponent.class)
public HttpComponent configureHttpComponent(CamelContext camelContext,
                                            HttpComponentConfiguration configuration) throws Exception {
    HttpComponent component = new HttpComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
        false);
    for (Map.Entry<String, Object> entry : parameters.entrySet()) {
        Object value = entry.getValue();
        Class<?> paramClass = value.getClass();
        if (paramClass.getName().endsWith("NestedConfiguration")) {
            Class<?> nestedClass = null;
            try {
                nestedClass = (Class<?>) paramClass.getDeclaredField(
                    "CAMEL_NESTED_CLASS").get(null);
                HashMap<String, Object> nestedParameters = new HashMap<>();
                IntrospectionSupport.getProperties(value, nestedParameters,
                    null, false);
                Object nestedProperty = nestedClass.newInstance();
                IntrospectionSupport.setProperties(camelContext,
                    camelContext.getTypeConverter(), nestedProperty,
                    nestedParameters);
                entry.setValue(nestedProperty);
            } catch (NoSuchFieldException e) {
            }
        }
    }
    IntrospectionSupport.setProperties(camelContext,
        camelContext.getTypeConverter(), component, parameters);
    return component;
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:36,代码来源:HttpComponentAutoConfiguration.java


注:本文中的org.apache.camel.util.IntrospectionSupport.setProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。