public final class PropertyBindingSupport extends Object
IntrospectionSupport
.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 void |
bindMandatoryProperty(org.apache.camel.CamelContext camelContext,
Object target,
String name,
Object value)
Binds the mandatory property to the target object (will fail if not set/bound).
|
static void |
bindMandatoryProperty(org.apache.camel.CamelContext camelContext,
Object target,
String name,
Object value,
boolean ignoreCase)
Binds the mandatory property to the target object (will fail if not set/bound).
|
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 |
bindProperties(org.apache.camel.CamelContext camelContext,
Object target,
Map<String,Object> properties,
boolean ignoreCase)
Binds the properties to the target object, and removes the property that was bound from properties.
|
static boolean |
bindProperties(org.apache.camel.CamelContext camelContext,
Object target,
Map<String,Object> properties,
String optionPrefix)
Binds the properties with the given prefix to the target object, and removes the property that was bound from properties.
|
static boolean |
bindProperties(org.apache.camel.CamelContext camelContext,
Object target,
Map<String,Object> properties,
String optionPrefix,
boolean ignoreCase)
Binds the properties with the given prefix to the target object, and removes the property that was bound from properties.
|
static boolean |
bindProperties(org.apache.camel.CamelContext camelContext,
Object target,
Map<String,Object> properties,
String optionPrefix,
boolean ignoreCase,
boolean nesting,
boolean deepNesting,
boolean fluentBuilder,
boolean allowPrivateSetter,
boolean reference,
boolean placeholder)
Binds the properties with the given prefix to the target object, and removes the property that was bound from properties.
|
static boolean |
bindProperty(org.apache.camel.CamelContext camelContext,
Object target,
String name,
Object value)
Binds the property to the target object.
|
static boolean |
bindProperty(org.apache.camel.CamelContext camelContext,
Object target,
String name,
Object value,
boolean ignoreCase)
Binds the property to the target object.
|
static PropertyBindingSupport.Builder |
build() |
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)
camelContext
- the camel contexttarget
- the target objectproperties
- the properties where the bound properties will be removed frompublic static boolean bindProperties(org.apache.camel.CamelContext camelContext, Object target, Map<String,Object> properties, boolean ignoreCase)
camelContext
- the camel contexttarget
- the target objectproperties
- the properties where the bound properties will be removed fromignoreCase
- whether to ignore case for property keyspublic static boolean bindProperties(org.apache.camel.CamelContext camelContext, Object target, Map<String,Object> properties, String optionPrefix)
camelContext
- the camel contexttarget
- the target objectproperties
- the properties where the bound properties will be removed fromoptionPrefix
- the prefix used to filter propertiespublic static boolean bindProperties(org.apache.camel.CamelContext camelContext, Object target, Map<String,Object> properties, String optionPrefix, boolean ignoreCase)
camelContext
- the camel contexttarget
- the target objectproperties
- the properties where the bound properties will be removed fromoptionPrefix
- the prefix used to filter propertiesignoreCase
- whether to ignore case for property keyspublic static boolean bindProperties(org.apache.camel.CamelContext camelContext, Object target, Map<String,Object> properties, String optionPrefix, boolean ignoreCase, boolean nesting, boolean deepNesting, boolean fluentBuilder, boolean allowPrivateSetter, boolean reference, boolean placeholder)
camelContext
- the camel contexttarget
- the target objectproperties
- the properties where the bound properties will be removed fromoptionPrefix
- the prefix used to filter propertiesignoreCase
- whether to ignore case for property keysnesting
- whether nesting is in usedeepNesting
- whether deep nesting is in use, where Camel will attempt to walk as deep as possible by creating new objects in the OGNL graph if
a property has a setter and the object can be created from a default no-arg constructor.fluentBuilder
- whether fluent builder is allowed as a valid getter/setterallowPrivateSetter
- whether autowiring components allows to use private setter method when setting the valuereference
- whether reference parameter (syntax starts with #) is in useplaceholder
- whether to use Camels property placeholder to resolve placeholders on keys and valuespublic static boolean bindProperty(org.apache.camel.CamelContext camelContext, Object target, String name, Object value) throws org.apache.camel.PropertyBindingException
camelContext
- the camel contexttarget
- the target objectname
- name of propertyvalue
- value of propertyorg.apache.camel.PropertyBindingException
- is thrown if error binding propertypublic static boolean bindProperty(org.apache.camel.CamelContext camelContext, Object target, String name, Object value, boolean ignoreCase) throws org.apache.camel.PropertyBindingException
camelContext
- the camel contexttarget
- the target objectname
- name of propertyvalue
- value of propertyignoreCase
- whether to ignore case for property keysorg.apache.camel.PropertyBindingException
- is thrown if error binding propertypublic static void bindMandatoryProperty(org.apache.camel.CamelContext camelContext, Object target, String name, Object value) throws org.apache.camel.PropertyBindingException
camelContext
- the camel contexttarget
- the target objectname
- name of propertyvalue
- value of propertyorg.apache.camel.PropertyBindingException
- is thrown if error binding property, or the property was not boundpublic static void bindMandatoryProperty(org.apache.camel.CamelContext camelContext, Object target, String name, Object value, boolean ignoreCase) throws org.apache.camel.PropertyBindingException
camelContext
- the camel contexttarget
- the target objectname
- name of propertyvalue
- value of propertyignoreCase
- whether to ignore case for property keysorg.apache.camel.PropertyBindingException
- is thrown if error binding property, or the property was not boundApache Camel