Package com.duncpro.jroute.route
Class Route
- java.lang.Object
-
- com.duncpro.jroute.route.Route
-
- Direct Known Subclasses:
ParameterizedRoute
@Immutable public class Route extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Route(java.lang.String routeString)Route(java.util.List<RouteElement> elements)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Routeconcat(Route... routes)booleanequals(java.lang.Object o)java.util.List<java.lang.String>extractVariables(Path path)Compiles a list of all the arguments contained within the given path.java.util.List<java.lang.String>extractVariables(java.lang.String path)java.util.List<RouteElement>getElements()inthashCode()booleanisRoot()Routeresolve(Route suffix)java.lang.StringtoString()RoutewithLeadingElement(RouteElement element)RoutewithoutLeadingElement()RoutewithTrailingElement(RouteElement element)
-
-
-
Field Detail
-
ROOT
public static Route ROOT
-
-
Constructor Detail
-
Route
public Route(java.util.List<RouteElement> elements)
-
Route
public Route(java.lang.String routeString)
-
-
Method Detail
-
extractVariables
public java.util.List<java.lang.String> extractVariables(java.lang.String path) throws java.lang.IllegalStateException- Throws:
java.lang.IllegalStateException
-
extractVariables
public java.util.List<java.lang.String> extractVariables(Path path) throws java.lang.IllegalStateException
Compiles a list of all the arguments contained within the given path. For example, consider the route string "/users/*\/pets/*" and the path "/users/duncan/pets/cocoa". The returned list would be ["duncan", "cocoa"].- Throws:
java.lang.IllegalStateException- if the givenpathStringis not of the same form as this route.
-
withoutLeadingElement
public Route withoutLeadingElement()
-
withLeadingElement
public Route withLeadingElement(RouteElement element)
-
withTrailingElement
public Route withTrailingElement(RouteElement element)
-
getElements
public java.util.List<RouteElement> getElements()
-
isRoot
public boolean isRoot()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-