Class Downcast<A extends B,B>

java.lang.Object
com.jnape.palatable.lambda.functions.builtin.fn1.Downcast<A,B>
Type Parameters:
A - the subtype
B - the supertype
All Implemented Interfaces:
Fn1<B,A>, Applicative<A,Fn1<B,?>>, Cartesian<B,A,Fn1<?,?>>, Cocartesian<B,A,Fn1<?,?>>, Contravariant<B,Profunctor<?,A,Fn1<?,?>>>, Functor<A,Fn1<B,?>>, Profunctor<B,A,Fn1<?,?>>, Monad<A,Fn1<B,?>>, MonadReader<B,A,Fn1<B,?>>, MonadRec<A,Fn1<B,?>>, MonadWriter<B,A,Fn1<B,?>>

public final class Downcast<A extends B,B> extends Object implements Fn1<B,A>
Covariantly cast a value of type B to a value of subtype A. Unsafe.
  • Field Details

    • INSTANCE

      private static final Downcast<?,?> INSTANCE
  • Constructor Details

    • Downcast

      private Downcast()
  • Method Details

    • checkedApply

      public A checkedApply(B b)
      Description copied from interface: Fn1
      Invoke this function with the given argument, potentially throwing any Throwable.
      Specified by:
      checkedApply in interface Fn1<A extends B,B>
      Parameters:
      b - the argument
      Returns:
      the result of the function application
    • downcast

      public static <A extends B, B> Downcast<A,B> downcast()
    • downcast

      public static <A extends B, B> A downcast(B b)