Class NativeType<T>

java.lang.Object
software.amazon.jsii.NativeType<T>

@Internal public abstract class NativeType<T> extends Object
  • Field Details

    • NO_TYPE_PARAMS

      protected static final com.fasterxml.jackson.databind.JavaType[] NO_TYPE_PARAMS
    • VOID

      public static final NativeType<Void> VOID
      A NativeType representation for `void`.
  • Constructor Details

    • NativeType

      protected NativeType(com.fasterxml.jackson.databind.JavaType javaType)
  • Method Details

    • forClass

      public static <T> NativeType<T> forClass(Class<T> simpleType)
      Creates a NativeType representation for classes that are neither List nor Map subclasses.
      Type Parameters:
      T - the static type of simpleType.
      Parameters:
      simpleType - the Java class to be represented.
      Returns:
      a new NativeType instance.
      Throws:
      IllegalArgumentException - if a List or Map subclass is passed as an argument.
    • listOf

      public static <T> NativeType<List<T>> listOf(NativeType<T> elementType)
      Creates a NativeType representation for a List of some elementType.
      Type Parameters:
      T - the static type of the elements in the List.
      Parameters:
      elementType - the type of elements in the List.
      Returns:
      a new NativeType instance.
    • mapOf

      public static <T> NativeType<Map<String,T>> mapOf(NativeType<T> elementType)
      Creates a NativeType representation for a Map of String to some elementType.
      Type Parameters:
      T - the static type of the values in the Map.
      Parameters:
      elementType - the type of values in the Map.
      Returns:
      a new NativeType instance.
    • forType

      public static <T> NativeType<T> forType(Type type)
      Creates a NativeType for the given Java type description. This particular API is unsafe and should not be used if any of the other APIs can be.
      Type Parameters:
      T - the static type of the represented type. This operation is not checked, leaving the caller responsible for ensuring the correct type is specified.
      Parameters:
      type - the Type to be represented. It can be any type, including a Class reference, however when a Class instance is available, the caller should use forClass(Class), listOf(NativeType) and mapOf(NativeType) appropriately instead, as this operation is not checked at runtime.
      Returns:
      a new NativeType instance.