本文整理汇总了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");
});
}
示例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;
}