Class UnsafeCast

java.lang.Object
software.amazon.jsii.UnsafeCast

public final class UnsafeCast extends Object
  • Method Details

    • unsafeCast

      public static <T extends JsiiSerializable> T unsafeCast(JsiiObject value, Class<T> target)
      Unsafely obtains a view on a given value as an instance of an interface annotated with the Jsii.Proxy annotation.
      Type Parameters:
      T - the return type of the cast.
      Parameters:
      value - the value to be converted.
      target - the target type to obtain. This must be an interface with the Jsii.Proxy annotation.
      Returns:
      the converted value. Will only return null if value is null.
      Throws:
      IllegalArgumentException - if the provided target is not a Jsii.Proxy annotated interface.