コード例 #1
0
 @Bean(name = "xquery-component")
 @ConditionalOnClass(CamelContext.class)
 @ConditionalOnMissingBean(XQueryComponent.class)
 public XQueryComponent configureXQueryComponent(
     CamelContext camelContext, XQueryComponentConfiguration configuration) throws Exception {
   XQueryComponent component = new XQueryComponent();
   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;
 }
コード例 #2
0
 @Bean(name = "xquery-component")
 @ConditionalOnClass(CamelContext.class)
 @ConditionalOnMissingBean(XQueryComponent.class)
 public XQueryComponent configureXQueryComponent(
     CamelContext camelContext, XQueryComponentConfiguration configuration) throws Exception {
   XQueryComponent component = new XQueryComponent();
   component.setCamelContext(camelContext);
   Map<String, Object> parameters = new HashMap<>();
   IntrospectionSupport.getProperties(configuration, parameters, null, false);
   IntrospectionSupport.setProperties(
       camelContext, camelContext.getTypeConverter(), component, parameters);
   return component;
 }