public final class CamelContextHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
MODEL_DOCUMENTATION_PREFIX |
Modifier and Type | Method and Description |
---|---|
static <T> T |
convertTo(org.apache.camel.CamelContext context,
Class<T> type,
Object value)
Converts the given value to the requested type
|
static <T> T |
findByType(org.apache.camel.CamelContext camelContext,
Class<T> type)
Look up a bean of the give type in the
Registry on the
CamelContext returning an instance if only one bean is present, |
static Properties |
getCamelPropertiesWithPrefix(String prefix,
org.apache.camel.CamelContext camelContext)
A helper method to access a camel context properties with a prefix
|
static org.apache.camel.Endpoint |
getEndpointInjection(org.apache.camel.CamelContext camelContext,
String uri,
String injectionPointName,
boolean mandatory)
Evaluates the @EndpointInject annotation using the given context
|
static org.apache.camel.Endpoint |
getMandatoryEndpoint(org.apache.camel.CamelContext camelContext,
String uri)
Returns the mandatory endpoint for the given URI or the
NoSuchEndpointException is thrown |
static <T extends org.apache.camel.Endpoint> |
getMandatoryEndpoint(org.apache.camel.CamelContext camelContext,
String uri,
Class<T> type)
Returns the mandatory endpoint for the given URI and type or the
NoSuchEndpointException is thrown |
static int |
getMaximumCachePoolSize(org.apache.camel.CamelContext camelContext)
Gets the maximum cache pool size.
|
static int |
getMaximumEndpointCacheSize(org.apache.camel.CamelContext camelContext)
Gets the maximum endpoint cache size.
|
static int |
getMaximumSimpleCacheSize(org.apache.camel.CamelContext camelContext)
Gets the maximum simple cache size.
|
static int |
getMaximumTransformerCacheSize(org.apache.camel.CamelContext camelContext)
Gets the maximum transformer cache size.
|
static int |
getMaximumValidatorCacheSize(org.apache.camel.CamelContext camelContext)
Gets the maximum validator cache size.
|
static String |
getRouteId(org.apache.camel.NamedNode node)
Gets the route id the given node belongs to.
|
static int |
getRouteStartupOrder(org.apache.camel.CamelContext camelContext,
String routeId)
Gets the route startup order for the given route id
|
static Object |
lookup(org.apache.camel.CamelContext context,
String name)
Look up the given named bean in the
Registry on the
CamelContext |
static <T> T |
lookup(org.apache.camel.CamelContext context,
String name,
Class<T> beanType)
Look up the given named bean of the given type in the
Registry on the
CamelContext |
static <T> T |
lookupAndConvert(org.apache.camel.CamelContext context,
String name,
Class<T> beanType)
Look up the given named bean in the
Registry on the
CamelContext and try to convert it to the given type. |
static <T> T |
mandatoryConvertTo(org.apache.camel.CamelContext context,
Class<T> type,
Object value)
Converts the given value to the specified type throwing an
IllegalArgumentException
if the value could not be converted to a non null value |
static Object |
mandatoryLookup(org.apache.camel.CamelContext context,
String name)
Look up the given named bean in the
Registry on the
CamelContext or throws NoSuchBeanException if not found. |
static <T> T |
mandatoryLookup(org.apache.camel.CamelContext context,
String name,
Class<T> beanType)
Look up the given named bean of the given type in the
Registry on the
CamelContext or throws NoSuchBeanException if not found. |
static <T> T |
mandatoryLookupAndConvert(org.apache.camel.CamelContext context,
String name,
Class<T> beanType)
Look up the given named bean in the
Registry on the
CamelContext and convert it to the given type or throws NoSuchBeanException if not found. |
static <T> T |
newInstance(org.apache.camel.CamelContext context,
Class<T> beanType)
Creates a new instance of the given type using the
Injector on the given
CamelContext |
static <T> T |
parse(org.apache.camel.CamelContext camelContext,
Class<T> clazz,
String text)
Parses the given text and converts it to the specified class and handling property placeholders as well
|
static Boolean |
parseBoolean(org.apache.camel.CamelContext camelContext,
String text)
Parses the given text and converts it to an Boolean and handling property placeholders as well
|
static Double |
parseDouble(org.apache.camel.CamelContext camelContext,
String text)
Parses the given text and converts it to a Double and handling property placeholders as well
|
static Float |
parseFloat(org.apache.camel.CamelContext camelContext,
String text)
Parses the given text and converts it to a Float and handling property placeholders as well
|
static Integer |
parseInt(org.apache.camel.CamelContext camelContext,
String text)
Parses the given text and converts it to an Integer and handling property placeholders as well
|
static Integer |
parseInteger(org.apache.camel.CamelContext camelContext,
String text)
Parses the given text and converts it to an Integer and handling property placeholders as well
|
static Long |
parseLong(org.apache.camel.CamelContext camelContext,
String text)
Parses the given text and converts it to an Long and handling property placeholders as well
|
static String |
parseText(org.apache.camel.CamelContext camelContext,
String text)
Parses the given text and handling property placeholders as well
|
static <T> T |
tryConvertTo(org.apache.camel.CamelContext context,
Class<T> type,
Object value)
Tried to convert the given value to the requested type
|
public static final String MODEL_DOCUMENTATION_PREFIX
public static org.apache.camel.Endpoint getMandatoryEndpoint(org.apache.camel.CamelContext camelContext, String uri) throws org.apache.camel.NoSuchEndpointException
NoSuchEndpointException
is thrownorg.apache.camel.NoSuchEndpointException
public static <T extends org.apache.camel.Endpoint> T getMandatoryEndpoint(org.apache.camel.CamelContext camelContext, String uri, Class<T> type)
NoSuchEndpointException
is thrownpublic static <T> T convertTo(org.apache.camel.CamelContext context, Class<T> type, Object value)
public static <T> T tryConvertTo(org.apache.camel.CamelContext context, Class<T> type, Object value)
public static <T> T mandatoryConvertTo(org.apache.camel.CamelContext context, Class<T> type, Object value)
IllegalArgumentException
if the value could not be converted to a non null valuepublic static <T> T newInstance(org.apache.camel.CamelContext context, Class<T> beanType)
Injector
on the given
CamelContext
public static Object lookup(org.apache.camel.CamelContext context, String name)
Registry
on the
CamelContext
public static <T> T lookup(org.apache.camel.CamelContext context, String name, Class<T> beanType)
Registry
on the
CamelContext
public static <T> T lookupAndConvert(org.apache.camel.CamelContext context, String name, Class<T> beanType)
Registry
on the
CamelContext
and try to convert it to the given type.public static <T> T findByType(org.apache.camel.CamelContext camelContext, Class<T> type)
Registry
on the
CamelContext
returning an instance if only one bean is present,public static Object mandatoryLookup(org.apache.camel.CamelContext context, String name)
Registry
on the
CamelContext
or throws NoSuchBeanException
if not found.public static <T> T mandatoryLookup(org.apache.camel.CamelContext context, String name, Class<T> beanType)
Registry
on the
CamelContext
or throws NoSuchBeanException if not found.public static <T> T mandatoryLookupAndConvert(org.apache.camel.CamelContext context, String name, Class<T> beanType)
Registry
on the
CamelContext
and convert it to the given type or throws NoSuchBeanException if not found.public static org.apache.camel.Endpoint getEndpointInjection(org.apache.camel.CamelContext camelContext, String uri, String injectionPointName, boolean mandatory)
public static int getMaximumCachePoolSize(org.apache.camel.CamelContext camelContext) throws IllegalArgumentException
Exchange.MAXIMUM_CACHE_POOL_SIZE
.
If no property has been set, then it will fallback to return a size of 1000.camelContext
- the camel contextIllegalArgumentException
- is thrown if the property is illegalpublic static int getMaximumEndpointCacheSize(org.apache.camel.CamelContext camelContext) throws IllegalArgumentException
Exchange.MAXIMUM_ENDPOINT_CACHE_SIZE
.
If no property has been set, then it will fallback to return a size of 1000.camelContext
- the camel contextIllegalArgumentException
- is thrown if the property is illegalpublic static int getMaximumSimpleCacheSize(org.apache.camel.CamelContext camelContext) throws IllegalArgumentException
Exchange.MAXIMUM_SIMPLE_CACHE_SIZE
.
If no property has been set, then it will fallback to return a size of 1000.camelContext
- the camel contextIllegalArgumentException
- is thrown if the property is illegalpublic static int getMaximumTransformerCacheSize(org.apache.camel.CamelContext camelContext) throws IllegalArgumentException
Exchange.MAXIMUM_TRANSFORMER_CACHE_SIZE
.
If no property has been set, then it will fallback to return a size of 1000.camelContext
- the camel contextIllegalArgumentException
- is thrown if the property is illegalpublic static int getMaximumValidatorCacheSize(org.apache.camel.CamelContext camelContext) throws IllegalArgumentException
Exchange.MAXIMUM_VALIDATOR_CACHE_SIZE
.
If no property has been set, then it will fallback to return a size of 1000.camelContext
- the camel contextIllegalArgumentException
- is thrown if the property is illegalpublic static String parseText(org.apache.camel.CamelContext camelContext, String text)
camelContext
- the camel contexttext
- the textIllegalStateException
- is thrown if illegal argumentpublic static Integer parseInteger(org.apache.camel.CamelContext camelContext, String text)
camelContext
- the camel contexttext
- the textIllegalStateException
- is thrown if illegal argument or type conversion not possiblepublic static Integer parseInt(org.apache.camel.CamelContext camelContext, String text)
camelContext
- the camel contexttext
- the textIllegalStateException
- is thrown if illegal argument or type conversion not possiblepublic static Long parseLong(org.apache.camel.CamelContext camelContext, String text)
camelContext
- the camel contexttext
- the textIllegalStateException
- is thrown if illegal argument or type conversion not possiblepublic static Float parseFloat(org.apache.camel.CamelContext camelContext, String text)
camelContext
- the camel contexttext
- the textIllegalStateException
- is thrown if illegal argument or type conversion not possiblepublic static Double parseDouble(org.apache.camel.CamelContext camelContext, String text)
camelContext
- the camel contexttext
- the textIllegalStateException
- is thrown if illegal argument or type conversion not possiblepublic static Boolean parseBoolean(org.apache.camel.CamelContext camelContext, String text)
camelContext
- the camel contexttext
- the textIllegalArgumentException
- is thrown if illegal argument or type conversion not possiblepublic static <T> T parse(org.apache.camel.CamelContext camelContext, Class<T> clazz, String text)
camelContext
- the camel contextclazz
- the class to convert the value totext
- the textIllegalArgumentException
- is thrown if illegal argument or type conversion not possiblepublic static int getRouteStartupOrder(org.apache.camel.CamelContext camelContext, String routeId)
camelContext
- the camel contextrouteId
- the id of the routepublic static Properties getCamelPropertiesWithPrefix(String prefix, org.apache.camel.CamelContext camelContext)
prefix
- the prefixcamelContext
- the camel contextpublic static String getRouteId(org.apache.camel.NamedNode node)
node
- the nodeApache Camel