public final class IntrospectionSupport extends Object
stop()
method when
CamelContext
is being stopped. This allows to clear the introspection cache.
This implementation will skip methods from java.lang.Object and java.lang.reflect.Proxy.
This implementation will use a cache when the getProperties(Object, java.util.Map, String)
method is being used. Also the cacheClass(Class)
method gives access to the introspect cache.Modifier and Type | Class and Description |
---|---|
static class |
IntrospectionSupport.ClassInfo
Structure of an introspected class.
|
static class |
IntrospectionSupport.MethodInfo
Structure of an introspected method.
|
Modifier and Type | Method and Description |
---|---|
static IntrospectionSupport.ClassInfo |
cacheClass(Class<?> clazz)
Introspects the given class.
|
static Map<String,Object> |
extractProperties(Map<String,Object> properties,
String optionPrefix) |
static Map<String,Object> |
extractProperties(Map<String,Object> properties,
String optionPrefix,
boolean remove) |
static Map<String,String> |
extractStringProperties(Map<String,Object> properties) |
static Set<Method> |
findSetterMethods(Class<?> clazz,
String name,
boolean allowBuilderPattern) |
protected static List<Method> |
findSetterMethodsOrderedByParameterType(Class<?> target,
String propertyName,
boolean allowBuilderPattern) |
static String |
getGetterShorthandName(Method method) |
static Map<String,Object> |
getNonNullProperties(Object target)
Will inspect the target for properties.
|
static Object |
getOrElseProperty(Object target,
String property,
Object defaultValue) |
static boolean |
getProperties(Object target,
Map<String,Object> properties,
String optionPrefix)
Will inspect the target for properties.
|
static boolean |
getProperties(Object target,
Map<String,Object> properties,
String optionPrefix,
boolean includeNull)
Will inspect the target for properties.
|
static Object |
getProperty(Object target,
String property) |
static Method |
getPropertyGetter(Class<?> type,
String propertyName) |
static Method |
getPropertySetter(Class<?> type,
String propertyName) |
static String |
getSetterShorthandName(Method method) |
static boolean |
hasProperties(Map<String,Object> properties,
String optionPrefix) |
static boolean |
isGetter(Method method) |
static boolean |
isPropertyIsGetter(Class<?> type,
String propertyName) |
static boolean |
isSetter(Method method) |
static boolean |
isSetter(Method method,
boolean allowBuilderPattern) |
static boolean |
setProperties(CamelContext context,
TypeConverter typeConverter,
Object target,
Map<String,Object> properties) |
static boolean |
setProperties(Object target,
Map<String,Object> properties) |
static boolean |
setProperties(Object target,
Map<String,Object> properties,
String optionPrefix) |
static boolean |
setProperties(Object target,
Map<String,Object> properties,
String optionPrefix,
boolean allowBuilderPattern) |
static boolean |
setProperties(TypeConverter typeConverter,
Object target,
Map<String,Object> properties) |
static boolean |
setProperty(CamelContext context,
Object target,
String name,
Object value) |
static boolean |
setProperty(CamelContext context,
TypeConverter typeConverter,
Object target,
String name,
Object value) |
static boolean |
setProperty(CamelContext context,
TypeConverter typeConverter,
Object target,
String name,
Object value,
String refName,
boolean allowBuilderPattern)
This method supports two modes to set a property:
1.
|
static boolean |
setProperty(Object target,
String name,
Object value) |
static boolean |
setProperty(Object target,
String name,
Object value,
boolean allowBuilderPattern) |
static boolean |
setProperty(TypeConverter typeConverter,
Object target,
String name,
Object value) |
static void |
stop()
CamelContext should call this stop method when its stopping. |
public static void stop()
CamelContext
should call this stop method when its stopping.
This implementation will clear its introspection cache.public static String getGetterShorthandName(Method method)
public static String getSetterShorthandName(Method method)
public static Map<String,Object> getNonNullProperties(Object target)
target
- the target beanpublic static boolean getProperties(Object target, Map<String,Object> properties, String optionPrefix)
target
- the target beanproperties
- the map to fill in found propertiesoptionPrefix
- an optional prefix to append the property keypublic static boolean getProperties(Object target, Map<String,Object> properties, String optionPrefix, boolean includeNull)
target
- the target beanproperties
- the map to fill in found propertiesoptionPrefix
- an optional prefix to append the property keyincludeNull
- whether to include null valuespublic static IntrospectionSupport.ClassInfo cacheClass(Class<?> clazz)
clazz
- the classIntrospectionSupport.ClassInfo
structure.public static boolean hasProperties(Map<String,Object> properties, String optionPrefix)
public static Object getProperty(Object target, String property) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
public static Object getOrElseProperty(Object target, String property, Object defaultValue)
public static Method getPropertyGetter(Class<?> type, String propertyName) throws NoSuchMethodException
NoSuchMethodException
public static Method getPropertySetter(Class<?> type, String propertyName) throws NoSuchMethodException
NoSuchMethodException
public static boolean isPropertyIsGetter(Class<?> type, String propertyName)
public static boolean setProperties(Object target, Map<String,Object> properties, String optionPrefix, boolean allowBuilderPattern) throws Exception
Exception
public static boolean setProperties(Object target, Map<String,Object> properties, String optionPrefix) throws Exception
Exception
public static Map<String,Object> extractProperties(Map<String,Object> properties, String optionPrefix)
public static Map<String,Object> extractProperties(Map<String,Object> properties, String optionPrefix, boolean remove)
public static Map<String,String> extractStringProperties(Map<String,Object> properties)
public static boolean setProperties(CamelContext context, TypeConverter typeConverter, Object target, Map<String,Object> properties) throws Exception
Exception
public static boolean setProperties(TypeConverter typeConverter, Object target, Map<String,Object> properties) throws Exception
Exception
public static boolean setProperties(Object target, Map<String,Object> properties) throws Exception
Exception
public static boolean setProperty(CamelContext context, TypeConverter typeConverter, Object target, String name, Object value, String refName, boolean allowBuilderPattern) throws Exception
context
and refName
are
NULL and value
is non-NULL.
2. Setting a property that has not yet been resolved, the property will be resolved based on the suitable methods
found matching the property name on the target
bean. For this mode to be triggered the parameters
context
and refName
must NOT be NULL, and value
MUST be NULL.Exception
public static boolean setProperty(CamelContext context, Object target, String name, Object value) throws Exception
Exception
public static boolean setProperty(CamelContext context, TypeConverter typeConverter, Object target, String name, Object value) throws Exception
Exception
public static boolean setProperty(TypeConverter typeConverter, Object target, String name, Object value) throws Exception
Exception
public static boolean setProperty(Object target, String name, Object value, boolean allowBuilderPattern) throws Exception
Exception
public static boolean setProperty(Object target, String name, Object value) throws Exception
Exception
public static Set<Method> findSetterMethods(Class<?> clazz, String name, boolean allowBuilderPattern)
protected static List<Method> findSetterMethodsOrderedByParameterType(Class<?> target, String propertyName, boolean allowBuilderPattern)
Apache Camel