Record Class TypedOptic<S,T,A,B>

java.lang.Object
java.lang.Record
com.mojang.datafixers.TypedOptic<S,T,A,B>

public record TypedOptic<S,T,A,B>(Set<TypeToken<? extends K1>> bounds, List<? extends TypedOptic.Element<?,?,?,?>> elements) extends Record
  • Constructor Details

    • TypedOptic

      public TypedOptic(TypeToken<? extends K1> proofBound, Type<S> sType, Type<T> tType, Type<A> aType, Type<B> bType, Optic<?,S,T,A,B> optic)
    • TypedOptic

      public TypedOptic(Set<TypeToken<? extends K1>> proofBounds, Type<S> sType, Type<T> tType, Type<A> aType, Type<B> bType, Optic<?,S,T,A,B> optic)
    • TypedOptic

      public TypedOptic(Set<TypeToken<? extends K1>> bounds, List<? extends TypedOptic.Element<?,?,?,?>> elements)
      Creates an instance of a TypedOptic record class.
      Parameters:
      bounds - the value for the bounds record component
      elements - the value for the elements record component
  • Method Details

    • apply

      public <P extends K2, Proof2 extends K1> App2<P,S,T> apply(TypeToken<Proof2> token, App<Proof2,P> proof, App2<P,A,B> argument)
    • outermost

      public Optic<?,S,T,?,?> outermost()
    • innermost

      public Optic<?,?,?,A,B> innermost()
    • sType

      public Type<S> sType()
    • tType

      public Type<T> tType()
    • aType

      public Type<A> aType()
    • bType

      public Type<B> bType()
    • compose

      public <A1, B1> TypedOptic<S,T,A1,B1> compose(TypedOptic<A,B,A1,B1> other)
    • upCast

      public <Proof2 extends K1> Optional<Optic<? super Proof2,S,T,A,B>> upCast(TypeToken<Proof2> proof)
    • instanceOf

      public static <Proof2 extends K1> boolean instanceOf(Collection<TypeToken<? extends K1>> bounds, TypeToken<Proof2> proof)
    • adapter

      public static <S, T> TypedOptic<S,T,S,T> adapter(Type<S> sType, Type<T> tType)
    • proj1

      public static <F, G, F2> TypedOptic<Pair<F,G>,Pair<F2,G>,F,F2> proj1(Type<F> fType, Type<G> gType, Type<F2> newType)
    • proj2

      public static <F, G, G2> TypedOptic<Pair<F,G>,Pair<F,G2>,G,G2> proj2(Type<F> fType, Type<G> gType, Type<G2> newType)
    • inj1

      public static <F, G, F2> TypedOptic<Either<F,G>,Either<F2,G>,F,F2> inj1(Type<F> fType, Type<G> gType, Type<F2> newType)
    • inj2

      public static <F, G, G2> TypedOptic<Either<F,G>,Either<F,G2>,G,G2> inj2(Type<F> fType, Type<G> gType, Type<G2> newType)
    • compoundListKeys

      public static <K, V, K2> TypedOptic<List<Pair<K,V>>,List<Pair<K2,V>>,K,K2> compoundListKeys(Type<K> aType, Type<K2> bType, Type<V> valueType)
    • compoundListElements

      public static <K, V, V2> TypedOptic<List<Pair<K,V>>,List<Pair<K,V2>>,V,V2> compoundListElements(Type<K> keyType, Type<V> aType, Type<V2> bType)
    • list

      public static <A, B> TypedOptic<List<A>,List<B>,A,B> list(Type<A> aType, Type<B> bType)
    • tagged

      public static <K, A, B> TypedOptic<Pair<K,?>,Pair<K,?>,A,B> tagged(TaggedChoice.TaggedChoiceType<K> sType, K key, Type<A> aType, Type<B> bType)
    • castOuter

      public TypedOptic<S,T,A,B> castOuter(Type<S> sType, Type<T> tType)
    • castOuterUnchecked

      public <S2, T2> TypedOptic<S2,T2,A,B> castOuterUnchecked(Type<S2> sType, Type<T2> tType)
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • bounds

      public Set<TypeToken<? extends K1>> bounds()
      Returns the value of the bounds record component.
      Returns:
      the value of the bounds record component
    • elements

      public List<? extends TypedOptic.Element<?,?,?,?>> elements()
      Returns the value of the elements record component.
      Returns:
      the value of the elements record component