public final class PropertyBindingSupport extends Object
Keys with dash style is supported and will internally be converted from dash to camel case style (eg queue-connection-factory => queueConnectionFactory)
Keys can be marked as optional if the key name starts with a question mark, such as:
foo=123 ?bar=false
Where foo is mandatory, and bar is optional.
Values can be marked as optional property placeholder if the values name starts with a question mark, such as:
username={{?clientUserName}}
Where the username property will only be set if the property placeholder clientUserName exists, otherwise the username is not affected.
Modifier and Type | Class and Description |
---|---|
static class |
PropertyBindingSupport.Builder
To use a fluent builder style to configure this property binding support.
|
static interface |
PropertyBindingSupport.OnAutowiring |
Modifier and Type | Method and Description |
---|---|
static boolean |
bindProperties(org.apache.camel.CamelContext camelContext,
Object target,
Map<String,Object> properties)
Binds the properties to the target object, and removes the property that was bound from properties.
|
static boolean |
bindWithFlattenProperties(org.apache.camel.CamelContext camelContext,
Object target,
Map<String,Object> properties)
Binds the properties to the target object, and removes the property that was bound from properties.
|
static PropertyBindingSupport.Builder |
build() |
static Object |
newInstanceConstructorParameters(org.apache.camel.CamelContext camelContext,
Class<?> type,
String parameters)
Creates a new bean instance using the constructor that takes the given set of parameters.
|
static Object |
newInstanceFactoryParameters(org.apache.camel.CamelContext camelContext,
Class<?> type,
String factoryMethod,
String parameters)
Creates a new bean instance using a public static factory method from the given class
|
static Object |
resolveBean(org.apache.camel.CamelContext camelContext,
Object value)
Resolves the value as either a class, type or bean.
|
public static PropertyBindingSupport.Builder build()
public static boolean bindProperties(org.apache.camel.CamelContext camelContext, Object target, Map<String,Object> properties)
build()
where each option can be customized, such as whether parameter should be removed, or whether
options are mandatory etc.camelContext
- the camel contexttarget
- the target objectproperties
- the properties (as flat key=value paris) where the bound properties will be removedbuild()
public static boolean bindWithFlattenProperties(org.apache.camel.CamelContext camelContext, Object target, Map<String,Object> properties)
build()
where each option can be customized, such as whether parameter should be removed, or whether
options are mandatory etc.camelContext
- the camel contexttarget
- the target objectproperties
- the properties as (map of maps) where the properties will be flattened, and bound properties
will be removedbuild()
public static Object newInstanceConstructorParameters(org.apache.camel.CamelContext camelContext, Class<?> type, String parameters) throws Exception
camelContext
- the camel contexttype
- the class type of the bean to createparameters
- the parameters for the constructorException
- is thrown if error creating the beanpublic static Object newInstanceFactoryParameters(org.apache.camel.CamelContext camelContext, Class<?> type, String factoryMethod, String parameters) throws Exception
camelContext
- the camel contexttype
- the class with the public static factory methodparameters
- optional parameters for the factory methodException
- is thrown if error creating the beanpublic static Object resolveBean(org.apache.camel.CamelContext camelContext, Object value) throws Exception
camelContext
- the camel contextvalue
- how to resolve the bean with a prefix of either #class:, #type: or #bean:Exception
- is thrown if error resolving the bean, or if the value is invalid.Apache Camel