Package org.apache.camel.component.bean
Class BeanInfo
- java.lang.Object
-
- org.apache.camel.component.bean.BeanInfo
-
public class BeanInfo extends Object
Represents the metadata about a bean type created via a combination of introspection and annotations together with some useful sensible defaults
-
-
Constructor Summary
Constructors Constructor Description BeanInfo(org.apache.camel.CamelContext camelContext, Class<?> type)
BeanInfo(org.apache.camel.CamelContext camelContext, Class<?> type, Method explicitMethod, ParameterMappingStrategy strategy, BeanComponent beanComponent)
BeanInfo(org.apache.camel.CamelContext camelContext, Class<?> type, ParameterMappingStrategy strategy, BeanComponent beanComponent)
BeanInfo(org.apache.camel.CamelContext camelContext, Method explicitMethod, ParameterMappingStrategy parameterMappingStrategy, BeanComponent beanComponent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MethodInfo
chooseMethod(Object pojo, org.apache.camel.Exchange exchange, String name)
Choose one of the available methods to invoke if we can match the message body to the body parameterprotected List<Annotation>[]
collectParameterAnnotations(Class<?> c, Method m)
protected void
collectParameterAnnotations(Class<?> c, Method m, List<Annotation>[] a)
MethodInvocation
createInvocation(Object pojo, org.apache.camel.Exchange exchange)
protected MethodInfo
createMethodInfo(Class<?> clazz, Method method)
org.apache.camel.CamelContext
getCamelContext()
static String
getGetterShorthandName(Method method)
MethodInfo
getMethodInfo(Method method)
Returns theMethodInfo
for the given method if it exists or null if there is no metadata available for the given methodList<MethodInfo>
getMethods()
Gets the list of methods sorted by A..Z method name.Class<?>
getType()
boolean
hasAnyMethodHandlerAnnotation()
Does any of the methods have a Canel @Handler annotation.boolean
hasMethod(String methodName)
Do we have a method with the given name.boolean
hasPublicConstructors()
Returns whether the bean class has any public constructors.boolean
hasPublicNoArgConstructors()
Returns whether the bean class has any public no-arg constructors.boolean
hasStaticMethod(String methodName)
Do we have a static method with the given name.static boolean
isGetter(Method method)
static boolean
isSetter(Method method)
protected boolean
isValidMethod(Class<?> clazz, Method method)
Validates whether the given method is a valid candidate for Camel Bean Binding.
-
-
-
Constructor Detail
-
BeanInfo
public BeanInfo(org.apache.camel.CamelContext camelContext, Class<?> type)
-
BeanInfo
public BeanInfo(org.apache.camel.CamelContext camelContext, Method explicitMethod, ParameterMappingStrategy parameterMappingStrategy, BeanComponent beanComponent)
-
BeanInfo
public BeanInfo(org.apache.camel.CamelContext camelContext, Class<?> type, ParameterMappingStrategy strategy, BeanComponent beanComponent)
-
BeanInfo
public BeanInfo(org.apache.camel.CamelContext camelContext, Class<?> type, Method explicitMethod, ParameterMappingStrategy strategy, BeanComponent beanComponent)
-
-
Method Detail
-
getType
public Class<?> getType()
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()
-
createInvocation
public MethodInvocation createInvocation(Object pojo, org.apache.camel.Exchange exchange) throws AmbiguousMethodCallException, MethodNotFoundException
-
getMethodInfo
public MethodInfo getMethodInfo(Method method)
Returns theMethodInfo
for the given method if it exists or null if there is no metadata available for the given method
-
createMethodInfo
protected MethodInfo createMethodInfo(Class<?> clazz, Method method)
-
collectParameterAnnotations
protected List<Annotation>[] collectParameterAnnotations(Class<?> c, Method m)
-
collectParameterAnnotations
protected void collectParameterAnnotations(Class<?> c, Method m, List<Annotation>[] a)
-
chooseMethod
protected MethodInfo chooseMethod(Object pojo, org.apache.camel.Exchange exchange, String name) throws AmbiguousMethodCallException
Choose one of the available methods to invoke if we can match the message body to the body parameter- Parameters:
pojo
- the bean to invoke a method onexchange
- the message exchangename
- an optional name of the method that must match, use null to indicate all methods- Returns:
- the method to invoke or null if no definitive method could be matched
- Throws:
AmbiguousMethodCallException
- is thrown if cannot choose method due to ambiguity
-
isValidMethod
protected boolean isValidMethod(Class<?> clazz, Method method)
Validates whether the given method is a valid candidate for Camel Bean Binding.- Parameters:
clazz
- the classmethod
- the method- Returns:
- true if valid, false to skip the method
-
hasMethod
public boolean hasMethod(String methodName)
Do we have a method with the given name. Shorthand method names for getters is supported, so you can pass in eg 'name' and Camel will can find the real 'getName' method instead.- Parameters:
methodName
- the method name- Returns:
- true if we have such a method.
-
hasStaticMethod
public boolean hasStaticMethod(String methodName)
Do we have a static method with the given name. Shorthand method names for getters is supported, so you can pass in eg 'name' and Camel will can find the real 'getName' method instead.- Parameters:
methodName
- the method name- Returns:
- true if we have such a static method.
-
hasPublicConstructors
public boolean hasPublicConstructors()
Returns whether the bean class has any public constructors.
-
hasPublicNoArgConstructors
public boolean hasPublicNoArgConstructors()
Returns whether the bean class has any public no-arg constructors.
-
getMethods
public List<MethodInfo> getMethods()
Gets the list of methods sorted by A..Z method name.- Returns:
- the methods.
-
hasAnyMethodHandlerAnnotation
public boolean hasAnyMethodHandlerAnnotation()
Does any of the methods have a Canel @Handler annotation.
-
isGetter
public static boolean isGetter(Method method)
-
isSetter
public static boolean isSetter(Method method)
-
-