RootInspector

class RootInspector<T>(val data: T) : Inspector<T>

RootInspector is the starting point for getting your data and corresponding paths from your deep nested model structure. Get this by calling the factory method inspectorOf.

Inspector is useful in validation process to know which model attribute is not valid.

Constructors

Link copied to clipboard
constructor(data: T)

Properties

Link copied to clipboard
open override val data: T

D representation of stored data

Link copied to clipboard
open override val path: String

String representation of the corresponding path in model

Functions

Link copied to clipboard
fun <D> Inspector<List<D>>.inspectEach(action: (Inspector<D>) -> Unit)
fun <K, V> Inspector<Map<K, V>>.inspectEach(action: (K, Inspector<V>) -> Unit)
fun <D, I> Inspector<List<D>>.inspectEach(idProvider: IdProvider<D, I>, action: (Inspector<D>) -> Unit)

Performs the given action on each Inspector.

Link copied to clipboard
open fun <X> map(lens: Lens<T, X>): Inspector<X>

creates a new Inspector for a part of your underlying data-model

Link copied to clipboard
fun <D, I> Inspector<List<D>>.mapByElement(element: D, idProvider: IdProvider<D, I>): Inspector<D>

Creates a new Inspector containing the element for the given element and idProvider from the original Inspector's List.

Link copied to clipboard

Creates a new Inspector containing the element for the given index from the original Inspector's List

Link copied to clipboard
fun <K, V> Inspector<Map<K, V>>.mapByKey(key: K): Inspector<V>

Creates a new Inspector containing the value for the given key from the original Inspector's Map

Link copied to clipboard
fun <D> Inspector<D?>.mapNull(default: D): Inspector<D>

Creates a new Inspector from a nullable parent inspector that either contains the original value or a given default value if the original value was null.