public class RouteFactory extends Object
As string routes can also be used to access data, you should never convert string routes using this class, except some situations where it is allowed.
| Constructor and Description |
|---|
RouteFactory()
Creates a factory with the defaults specified by
GeneralSettings.DEFAULT_ROUTE_SEPARATOR and GeneralSettings.DEFAULT_ESCAPED_SEPARATOR. |
RouteFactory(GeneralSettings generalSettings)
Creates a factory with the separator specified by the given settings.
|
RouteFactory(char separator)
Creates a factory with the given separator.
|
| Modifier and Type | Method and Description |
|---|---|
Route |
create(String route)
Constructs a route from the given string route, by splitting it by the factory's separator.
|
String |
getEscapedSeparator()
Returns the escaped version of
getSeparator(). |
char |
getSeparator()
Returns the separator character.
|
public RouteFactory(@NotNull
GeneralSettings generalSettings)
generalSettings - settings from which to get the separatorpublic RouteFactory(char separator)
separator - separator to usepublic RouteFactory()
GeneralSettings.DEFAULT_ROUTE_SEPARATOR and GeneralSettings.DEFAULT_ESCAPED_SEPARATOR.@NotNull public Route create(String route)
As string routes can also be used to access data, you should never convert string routes using this method, except some situations where it is allowed.
The given keys are traversed in order as they were specified. Assuming route ["x", "y"], processor
attempts to get section at key "x" in the section from which the getter/setter... method was called;
and then value at key "y" in that section.
As routes are immutable objects, to save resources, it is recommended to create that certain route only once and then reuse it.
route - the string route to split (in format a.b for factory separator '.' to
create route [a, b])public char getSeparator()
@NotNull public String getEscapedSeparator()
getSeparator().Copyright © 2022. All rights reserved.