Class DefaultStateTransitionComparator
java.lang.Object
org.springframework.batch.core.job.flow.support.DefaultStateTransitionComparator
- All Implemented Interfaces:
Comparator<StateTransition>
Sorts by descending specificity of pattern, based on counting wildcards (with ? being
considered more specific than *). This means that more specific patterns will be
considered greater than less specific patterns. Hence foo > fo? > ??? > foo*
> *
For more complex comparisons, any string containing at least one * token will be
considered more generic than any string that has no * token. If both strings have at
least one * token, then the string with fewer * tokens will be considered the most
generic. If both strings have the same number of * tokens, then the comparison will
fall back to length of the overall string with the shortest value being the most
generic. Finally, if the * token count is equal and the string length is equal then the
final comparison will be alphabetic.
When two strings have ? tokens, then the string with the most ? tokens will be
considered the most generic. If both strings have the same number of ? tokens, then the
comparison will fall back to length of the overall string with the shortest value being
the most generic. Finally, if the ? token count is equal and the string length is equal
then the final comparison will be alphabetic
If the strings contain neither * nor ? tokens then alphabetic comparison will be used.
Hence bar > foo > fo? > bar?? > foo?? > ?0? > ??? > *foo* > *f*
> foo* > *
- Since:
- 3.0
- Author:
- Michael Minella, Robert McNees
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
STATE_TRANSITION_COMPARATOR
- See Also:
-
-
Constructor Details
-
DefaultStateTransitionComparator
public DefaultStateTransitionComparator()
-
-
Method Details
-
compare
- Specified by:
compare
in interfaceComparator<StateTransition>
-