org.apache.camel.model
Class ProcessorDefinitionHelper

java.lang.Object
  extended by org.apache.camel.model.ProcessorDefinitionHelper

public final class ProcessorDefinitionHelper
extends Object

Helper class for ProcessorDefinition and the other model classes.


Method Summary
static
<T> Iterator<T>
filterTypeInOutputs(List<ProcessorDefinition> outputs, Class<T> type)
          Looks for the given type in the list of outputs and recurring all the children as well.
static
<T> T
findFirstTypeInOutputs(List<ProcessorDefinition> outputs, Class<T> type)
          Looks for the given type in the list of outputs and recurring all the children as well.
static RouteDefinition getRoute(ProcessorDefinition<?> node)
          Gets the route definition the given node belongs to.
static boolean hasOutputs(List<ProcessorDefinition> outputs, boolean excludeAbstract)
          Is there any outputs in the given list.
static boolean isFirstChildOfType(Class<?> parentType, ProcessorDefinition<?> node)
          Is the given child the first in the outputs from the parent?
static boolean isParentOfType(Class<?> parentType, ProcessorDefinition<?> node, boolean recursive)
          Is the given node parent(s) of the given type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

filterTypeInOutputs

public static <T> Iterator<T> filterTypeInOutputs(List<ProcessorDefinition> outputs,
                                                  Class<T> type)
Looks for the given type in the list of outputs and recurring all the children as well.

Parameters:
outputs - list of outputs, can be null or empty.
type - the type to look for
Returns:
the found definitions, or null if not found

findFirstTypeInOutputs

public static <T> T findFirstTypeInOutputs(List<ProcessorDefinition> outputs,
                                           Class<T> type)
Looks for the given type in the list of outputs and recurring all the children as well. Will stop at first found and return it.

Parameters:
outputs - list of outputs, can be null or empty.
type - the type to look for
Returns:
the first found type, or null if not found

isFirstChildOfType

public static boolean isFirstChildOfType(Class<?> parentType,
                                         ProcessorDefinition<?> node)
Is the given child the first in the outputs from the parent?

Parameters:
parentType - the type the parent must be
node - the node
Returns:
true if first child, false otherwise

isParentOfType

public static boolean isParentOfType(Class<?> parentType,
                                     ProcessorDefinition<?> node,
                                     boolean recursive)
Is the given node parent(s) of the given type

Parameters:
parentType - the parent type
node - the current node
recursive - whether or not to check grand parent(s) as well
Returns:
true if parent(s) is of given type, false otherwise

getRoute

public static RouteDefinition getRoute(ProcessorDefinition<?> node)
Gets the route definition the given node belongs to.

Parameters:
node - the node
Returns:
the route, or null if not possible to find

hasOutputs

public static boolean hasOutputs(List<ProcessorDefinition> outputs,
                                 boolean excludeAbstract)
Is there any outputs in the given list.

Is used for check if the route output has any real outputs (non abstracts)

Parameters:
outputs - the outputs
excludeAbstract - whether or not to exclude abstract outputs (e.g. skip onException etc.)
Returns:
true if has outputs, otherwise false is returned


Apache CAMEL