Class Index<Target,TargetList extends HList.HCons<?,?>>
java.lang.Object
com.jnape.palatable.lambda.adt.hlist.Index<Target,TargetList>
- Type Parameters:
Target
- the target element typeTargetList
- type of compatible HList
HList indexes representing a value at arbitrary depth in some compatible HList. HList compatibility requires
identical element types up to and including the target element, but thereafter is unconstrained in length and element
type.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal <NewHead> Index
<Target, HList.HCons<NewHead, ? extends TargetList>> after()
Nest this index deeper by one element.abstract Target
get
(TargetList hList) Retrieve the value at this index in hList.static <Target> Index
<Target, HList.HCons<Target, ?>> index()
Create a root index for a head value of typeTarget
.abstract <L extends TargetList>
LSet a new value of the same type at this index in anHList
.
-
Constructor Details
-
Index
private Index()
-
-
Method Details
-
after
Nest this index deeper by one element.- Type Parameters:
NewHead
- the type of the preceding element- Returns:
- an index at the same Target, nested one level deep
-
get
Retrieve the value at this index in hList.- Parameters:
hList
- the hList- Returns:
- the value at this index
-
set
Set a new value of the same type at this index in anHList
.- Type Parameters:
L
- the inferred tail type of the HList- Parameters:
newElement
- the new valuehList
- the HList- Returns:
- the updated HList
-
index
Create a root index for a head value of typeTarget
.- Type Parameters:
Target
- the type of the value to get- Returns:
- the root index
-