| Constructor and Description |
|---|
SingleKeyRoute(Object key)
Constructs route from the given single key, enabling usage of wide-range data types as keys.
|
| Modifier and Type | Method and Description |
|---|---|
Route |
add(Object key)
Creates a new route, copies this route's backing array, adds the given key at the end and returns the new route
created from the new array.
|
boolean |
equals(Object o) |
Object |
get(int i)
Returns key in this route (from the backing array), at the given position.
|
int |
hashCode() |
String |
join(char separator)
Joins the route's keys with the given separator.
|
int |
length()
Returns the length of the route (backing array) - amount of keys forming this route.
|
Route |
parent()
Returns the parent route of this one.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitaddTo, from, from, fromSingleKey, fromString, fromString, fromStringpublic SingleKeyRoute(@NotNull
Object key)
The given key cannot be null.
As routes are immutable objects, to save resources, it is recommended to create individual routes only once and then reuse them.
key - the single element in the route@NotNull public String join(char separator)
Routepublic int length()
Route@NotNull public Object get(int i)
RouteRoute.length().@NotNull public Route parent()
RouteMore formally, creates a new route and copies this route's backing array without the last element.
Please note that if this route's Route.length() is 1, invoking this method will create an IllegalArgumentException, as it is illegal to have empty routes. See more at Route.from(Object...).
@NotNull public Route add(@NotNull Object key)
Route
The given key cannot be null, it is required to verify that.
It is in the caller's best interest to never modify the objects given (and their contents), as it might cause several issues (inequalities between routes...).
public boolean equals(Object o)
public int hashCode()
Copyright © 2022. All rights reserved.