Package org.restlet.util
Class RouteList
Modifiable list of routes with some helper methods. Note that this class
implements the
Note that structural changes to this list are thread-safe, using an underlying
List interface using the Route class as the generic
type. This allows you to use an instance of this class as any other
List, in particular all the helper methods in
Collections.Note that structural changes to this list are thread-safe, using an underlying
CopyOnWriteArrayList.- Author:
- Jerome Louvel
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the best route match for a given call.Returns the first route match for a given call.Returns the last route match for a given call.Returns a next route match in a round robin mode for a given call.Returns a random route match for a given call.voidRemoves all routes routing to a given target.subList(int fromIndex, int toIndex) Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.Methods inherited from class org.restlet.util.WrapperList
add, add, addAll, addAll, clear, contains, containsAll, equals, get, getDelegate, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
replaceAll, sort, spliterator
-
Constructor Details
-
RouteList
public RouteList()Constructor. -
RouteList
Constructor.- Parameters:
delegate- The delegate list.
-
-
Method Details
-
getBest
Returns the best route match for a given call.- Parameters:
request- The request to score.response- The response to score.requiredScore- The minimum score required to have a match.- Returns:
- The best route match or null.
-
getFirst
Returns the first route match for a given call.- Parameters:
request- The request to score.response- The response to score.requiredScore- The minimum score required to have a match.- Returns:
- The first route match or null.
-
getLast
Returns the last route match for a given call.- Parameters:
request- The request to score.response- The response to score.requiredScore- The minimum score required to have a match.- Returns:
- The last route match or null.
-
getNext
Returns a next route match in a round robin mode for a given call.- Parameters:
request- The request to score.response- The response to score.requiredScore- The minimum score required to have a match.- Returns:
- A next route or null.
-
getRandom
Returns a random route match for a given call. Note that the current implementation doesn't uniformly return routes unless they all score above the required score.- Parameters:
request- The request to score.response- The response to score.requiredScore- The minimum score required to have a match.- Returns:
- A random route or null.
-
removeAll
Removes all routes routing to a given target.- Parameters:
target- The target Restlet to detach.
-
subList
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
-