public class DefaultManagementNameStrategy extends Object implements ManagementNameStrategy
ManagementNameStrategy
This implementation will by default use a name pattern as #name# and in case
of a clash, then the pattern will fallback to be using the counter as #name#-#counter#.Constructor and Description |
---|
DefaultManagementNameStrategy(CamelContext camelContext) |
DefaultManagementNameStrategy(CamelContext camelContext,
String defaultPattern,
String nextPattern) |
Modifier and Type | Method and Description |
---|---|
protected String |
customResolveManagementName(String pattern,
String answer)
Strategy to do any custom resolution of the name
|
String |
getName()
Gets the name
The
ManagementNameStrategy.isFixedName() determines if the name can be re-calculated such as when using a counter,
or the name is always fixed. |
String |
getNamePattern()
Gets the custom name pattern.
|
String |
getNextName()
Gets the next calculated name, if this strategy is not using fixed names.
|
boolean |
isFixedName()
Whether the name will be fixed, or allow re-calculation such as by using an unique counter.
|
String |
resolveManagementName(String pattern,
String name,
boolean invalidCheck)
Creates a new management name with the given pattern
|
static void |
setCounter(int value)
To reset the counter, should only be used for testing purposes.
|
void |
setNamePattern(String namePattern)
Sets a custom name pattern, which will be used instead of any default patterns.
|
public DefaultManagementNameStrategy(CamelContext camelContext)
public DefaultManagementNameStrategy(CamelContext camelContext, String defaultPattern, String nextPattern)
public String getNamePattern()
ManagementNameStrategy
getNamePattern
in interface ManagementNameStrategy
public void setNamePattern(String namePattern)
ManagementNameStrategy
setNamePattern
in interface ManagementNameStrategy
namePattern
- a custom name pattern.public String getName()
ManagementNameStrategy
ManagementNameStrategy.isFixedName()
determines if the name can be re-calculated such as when using a counter,
or the name is always fixed.getName
in interface ManagementNameStrategy
public String getNextName()
ManagementNameStrategy
ManagementNameStrategy.isFixedName()
determines if the name can be re-calculated such as when using a counter,
or the name is always fixed.getNextName
in interface ManagementNameStrategy
public boolean isFixedName()
ManagementNameStrategy
isFixedName
in interface ManagementNameStrategy
public String resolveManagementName(String pattern, String name, boolean invalidCheck)
resolveManagementName
in interface ManagementNameStrategy
pattern
- the patternname
- the nameinvalidCheck
- whether to check for invalid patternIllegalArgumentException
- if the pattern or name is invalid or emptyprotected String customResolveManagementName(String pattern, String answer)
pattern
- the patternanswer
- the current answer, which may have custom patterns still to be resolvedpublic static void setCounter(int value)
value
- the counter valueApache Camel