Class RouteSpec
- java.lang.Object
-
- com.broadleafcommerce.metadata.route.builder.RouteSpec
-
- Direct Known Subclasses:
RouteSpec.RouteBooleanSpec
,RouteSpec.RouteBooleanSpec.RouteBooleanOpSpec
public class RouteSpec extends Object
A specification used for creating aComponentRoute
.- Author:
- Nick Crum (ncrum)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RouteSpec.RouteBooleanSpec
A specification extension forRouteSpec
that provides an entry-point to chain together predicates through methodsRouteSpec.RouteBooleanSpec.and()
,RouteSpec.RouteBooleanSpec.or()
, andRouteSpec.RouteBooleanSpec.negate()
.
-
Constructor Summary
Constructors Constructor Description RouteSpec(RoutesSpec parent)
RouteSpec(RoutesSpec parent, ComponentRoute.ComponentRouteBuilder routeBuilder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RouteSpec.RouteBooleanSpec
applicationOnly()
Adds a special predicate to limit this route to only be returned for a strict application context.protected ComponentRoute
build()
RouteSpec
clearScopes()
Clears the scopes for the route.RouteSpec
componentId(String componentId)
Sets the component ID of the route.RouteSpec
componentName(String componentName)
Sets the component name of the route.RouteSpec
exact(boolean exact)
Sets whether or not the route must match exactly.protected <B> B
getBean(Class<B> beanClass)
RouteSpec
order(int order)
Sets the absolute ordering of the route.RouteSpec
path(String path)
Sets the path of the route.RouteSpec.RouteBooleanSpec
predicate(Predicate<org.springframework.web.context.request.WebRequest> predicate)
Sets a predicate for the route.RouteSpec
scope(String scope)
Adds the scope to the route.RouteSpec
scopes(List<String> scopes)
Sets the scopes for the route.RouteSpec.RouteBooleanSpec
tenancy(Consumer<TenancyRoutePredicateFactory.Config> fn)
Adds a special predicate for limiting this route to certain tenancy contexts.RouteSpec.RouteBooleanSpec
tenantOnly()
Adds a special predicate to limit this route to only be returned for a strict tenant context.
-
-
-
Constructor Detail
-
RouteSpec
public RouteSpec(RoutesSpec parent)
-
RouteSpec
public RouteSpec(RoutesSpec parent, ComponentRoute.ComponentRouteBuilder routeBuilder)
-
-
Method Detail
-
path
public RouteSpec path(String path)
Sets the path of the route.- Parameters:
path
- the new route path- Returns:
- this
-
componentId
public RouteSpec componentId(String componentId)
Sets the component ID of the route.- Parameters:
componentId
- the new component ID- Returns:
- this
-
componentName
public RouteSpec componentName(String componentName)
Sets the component name of the route.- Parameters:
componentName
- the new component name- Returns:
- this
-
scope
public RouteSpec scope(String scope)
Adds the scope to the route.- Parameters:
scope
- a new scope- Returns:
- this
-
scopes
public RouteSpec scopes(List<String> scopes)
Sets the scopes for the route.- Parameters:
scopes
- the new scopes- Returns:
- this
-
clearScopes
public RouteSpec clearScopes()
Clears the scopes for the route.- Returns:
- this
-
order
public RouteSpec order(int order)
Sets the absolute ordering of the route. Lower numbers indicate higher precedence.- Parameters:
order
- the new order of the route- Returns:
- this
-
exact
public RouteSpec exact(boolean exact)
Sets whether or not the route must match exactly.- Parameters:
exact
- whether or not exact match is required- Returns:
- this
- See Also:
for more details
-
predicate
public RouteSpec.RouteBooleanSpec predicate(Predicate<org.springframework.web.context.request.WebRequest> predicate)
Sets a predicate for the route.- Parameters:
predicate
- the new predicate- Returns:
- this
-
tenancy
public RouteSpec.RouteBooleanSpec tenancy(Consumer<TenancyRoutePredicateFactory.Config> fn)
Adds a special predicate for limiting this route to certain tenancy contexts.- Parameters:
fn
- a function to configure the tenancy context- Returns:
- a
RouteSpec.RouteBooleanSpec
to allow chaining of predicates
-
tenantOnly
public RouteSpec.RouteBooleanSpec tenantOnly()
Adds a special predicate to limit this route to only be returned for a strict tenant context.- Returns:
- a
RouteSpec.RouteBooleanSpec
to allow chaining of predicates
-
applicationOnly
public RouteSpec.RouteBooleanSpec applicationOnly()
Adds a special predicate to limit this route to only be returned for a strict application context.- Returns:
- a
RouteSpec.RouteBooleanSpec
to allow chaining of predicates
-
build
protected ComponentRoute build()
-
getBean
protected <B> B getBean(Class<B> beanClass)
-
-