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.
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 |
autowireSingletonPropertiesFromRegistry(org.apache.camel.CamelContext camelContext,
Object target)
This will discover all the properties on the target, and automatic bind the properties that are null by looking
up in the registry to see if there is a single instance of the same type as the property.
|
static boolean |
autowireSingletonPropertiesFromRegistry(org.apache.camel.CamelContext camelContext,
Object target,
boolean bindNullOnly,
boolean deepNesting,
PropertyBindingSupport.OnAutowiring callback)
This will discover all the properties on the target, and automatic bind the properties by looking up in the
registry to see if there is a single instance of the same type as the property.
|
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 |
resolveBean(org.apache.camel.CamelContext camelContext,
String name,
Object value)
Resolves the value as either a class, type or bean.
|
public static PropertyBindingSupport.Builder build()
public static boolean autowireSingletonPropertiesFromRegistry(org.apache.camel.CamelContext camelContext, Object target)
camelContext
- the camel contexttarget
- the target objectpublic static boolean autowireSingletonPropertiesFromRegistry(org.apache.camel.CamelContext camelContext, Object target, boolean bindNullOnly, boolean deepNesting, PropertyBindingSupport.OnAutowiring callback)
camelContext
- the camel contexttarget
- the target objectbindNullOnly
- whether to only autowire if the property has no default value or has not been configured
explicitdeepNesting
- whether to attempt to walk as deep down the object graph by creating new empty objects on
the way if needed (Camel can only create new empty objects if they have a default no-arg
constructor, also mind that this may lead to creating many empty objects, even if they will
not have any objects autowired from the registry, so use this with caution)callback
- optional callback when a property was auto wiredpublic 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 resolveBean(org.apache.camel.CamelContext camelContext, String name, Object value) throws Exception
camelContext
- the camel contextname
- the name of the beanvalue
- 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