public final class Hook extends Object implements TypeTemplate
Modifier and Type | Class and Description |
---|---|
static interface |
Hook.HookFunction |
static class |
Hook.HookType<A> |
Constructor and Description |
---|
Hook(TypeTemplate element,
Hook.HookFunction preRead,
Hook.HookFunction postWrite) |
Modifier and Type | Method and Description |
---|---|
TypeFamily |
apply(TypeFamily family) |
<A,B> FamilyOptic<A,B> |
applyO(FamilyOptic<A,B> input,
Type<A> aType,
Type<B> bType) |
boolean |
equals(Object obj) |
<FT,FR> (TypeTemplate|Type.FieldNotFoundException) |
findFieldOrType(int index,
String name,
Type<FT> type,
Type<FR> resultType)
returned optic will accept
template<family<index>> with the input template, and will return the same with the returned template. |
int |
hashCode() |
(int) -> RewriteResult<?,?> |
hmap(TypeFamily family,
(int) -> RewriteResult<?,?> function)
constraint: family, argFamily and resFamily are matched.
|
int |
size() |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
toSimpleType
public Hook(TypeTemplate element, Hook.HookFunction preRead, Hook.HookFunction postWrite)
public int size()
size
in interface TypeTemplate
public TypeFamily apply(TypeFamily family)
apply
in interface TypeTemplate
public <A,B> FamilyOptic<A,B> applyO(FamilyOptic<A,B> input, Type<A> aType, Type<B> bType)
applyO
in interface TypeTemplate
public <FT,FR> (TypeTemplate|Type.FieldNotFoundException) findFieldOrType(int index, @Nullable String name, Type<FT> type, Type<FR> resultType)
TypeTemplate
template<family<index>>
with the input template, and will return the same with the returned template.
(template, optic) = Left(result)
this.apply(family).apply(index) == optic.sType
template.apply(family).apply(index) == optic.tType
findFieldOrType
in interface TypeTemplate
public (int) -> RewriteResult<?,?> hmap(TypeFamily family, (int) -> RewriteResult<?,?> function)
TypeTemplate
result.function(i) :: this.apply(function.argFamily()).apply(i) -> this.apply(function.resFamily()).apply(i)
hmap
in interface TypeTemplate