public final class CamelContextHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
COMPONENT_DESCRIPTOR |
Modifier and Type | Method and Description |
---|---|
static <T> T |
convertTo(CamelContext context,
Class<T> type,
Object value)
Converts the given value to the requested type
|
static SortedMap<String,Properties> |
findComponents(CamelContext camelContext)
Finds all possible Components on the classpath and Registry
|
static Endpoint |
getEndpointInjection(CamelContext camelContext,
String uri,
String ref,
String injectionPointName,
boolean mandatory)
Evaluates the @EndpointInject annotation using the given context
|
static Endpoint |
getMandatoryEndpoint(CamelContext camelContext,
String uri)
Returns the mandatory endpoint for the given URI or the
NoSuchEndpointException is thrown |
static <T extends Endpoint> |
getMandatoryEndpoint(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(CamelContext camelContext)
Gets the maximum cache pool size.
|
static int |
getMaximumEndpointCacheSize(CamelContext camelContext)
Gets the maximum endpoint cache size.
|
static int |
getRouteStartupOrder(CamelContext camelContext,
String routeId)
Gets the route startup order for the given route id
|
static Object |
lookup(CamelContext context,
String name)
Look up the given named bean in the
Registry on the
CamelContext |
static <T> T |
lookup(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 |
mandatoryConvertTo(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(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(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 |
newInstance(CamelContext context,
Class<T> beanType)
Creates a new instance of the given type using the
Injector on the given
CamelContext |
static Boolean |
parseBoolean(CamelContext camelContext,
String text)
Parses the given text and converts it to an Boolean and handling property placeholders as well
|
static Double |
parseDouble(CamelContext camelContext,
String text)
Parses the given text and converts it to a Double and handling property placeholders as well
|
static Integer |
parseInteger(CamelContext camelContext,
String text)
Parses the given text and converts it to an Integer and handling property placeholders as well
|
static Long |
parseLong(CamelContext camelContext,
String text)
Parses the given text and converts it to an Long and handling property placeholders as well
|
static String |
parseText(CamelContext camelContext,
String text)
Parses the given text and handling property placeholders as well
|
public static final String COMPONENT_DESCRIPTOR
public static Endpoint getMandatoryEndpoint(CamelContext camelContext, String uri) throws NoSuchEndpointException
NoSuchEndpointException
is thrownNoSuchEndpointException
public static <T extends Endpoint> T getMandatoryEndpoint(CamelContext camelContext, String uri, Class<T> type)
NoSuchEndpointException
is thrownpublic static <T> T convertTo(CamelContext context, Class<T> type, Object value)
public static <T> T mandatoryConvertTo(CamelContext context, Class<T> type, Object value)
IllegalArgumentException
if the value could not be converted to a non null valuepublic static <T> T newInstance(CamelContext context, Class<T> beanType)
Injector
on the given
CamelContext
public static Object lookup(CamelContext context, String name)
Registry
on the
CamelContext
public static <T> T lookup(CamelContext context, String name, Class<T> beanType)
Registry
on the
CamelContext
public static Object mandatoryLookup(CamelContext context, String name)
Registry
on the
CamelContext
or throws NoSuchBeanException
if not found.public static <T> T mandatoryLookup(CamelContext context, String name, Class<T> beanType)
Registry
on the
CamelContext
or throws NoSuchBeanException if not found.public static Endpoint getEndpointInjection(CamelContext camelContext, String uri, String ref, String injectionPointName, boolean mandatory)
public static int getMaximumCachePoolSize(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(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 String parseText(CamelContext camelContext, String text) throws Exception
camelContext
- the camel contexttext
- the textException
- is thrown if illegal argumentpublic static Integer parseInteger(CamelContext camelContext, String text) throws Exception
camelContext
- the camel contexttext
- the textException
- is thrown if illegal argument or type conversion not possiblepublic static Long parseLong(CamelContext camelContext, String text) throws Exception
camelContext
- the camel contexttext
- the textException
- is thrown if illegal argument or type conversion not possiblepublic static Double parseDouble(CamelContext camelContext, String text) throws Exception
camelContext
- the camel contexttext
- the textException
- is thrown if illegal argument or type conversion not possiblepublic static Boolean parseBoolean(CamelContext camelContext, String text) throws Exception
camelContext
- the camel contexttext
- the textException
- is thrown if illegal argument or type conversion not possiblepublic static SortedMap<String,Properties> findComponents(CamelContext camelContext) throws LoadPropertiesException
LoadPropertiesException
public static int getRouteStartupOrder(CamelContext camelContext, String routeId)
camelContext
- the camel contextrouteId
- the id of the routeApache Camel