| Constructor and Description |
|---|
MultiKeyRoute(Object... route)
Constructs route from the given array of keys/key arguments, 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 MultiKeyRoute(@NotNull
Object... route)
The given array cannot contain null keys.
Empty array is considered illegal and will throw an IllegalArgumentException. Call with null
supplied as the route argument (e.g. from((Object[]) null)) will throw a NullPointerException.
The given keys are traversed in order as they were specified - just like folders: assuming route ["x",
1], processor attempts to get section at key "x" in the section from which the
getter/setter... method was called; and then value at key 1 in that section.
If varargs format is used and there is only one argument, it will automatically be interpreted as call to Route.from(Object), saving time and memory consumption.
If passing an array as the only key, do not forget to cast it to Object, otherwise it will be
interpreted as multi-key route according to the array's contents. Alternatively, to avoid confusion, use Route.fromSingleKey(Object)
As routes are immutable objects, to save resources, it is recommended to create individual routes only once and then reuse them.
route - the route array@NotNull public String join(char separator)
Routepublic int length()
Route@NotNull public Object get(int i)
RouteRoute.length().@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...).
@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...).
public boolean equals(Object o)
public int hashCode()
Copyright © 2022. All rights reserved.