Annotation Type TypeHint


  • @Repeatable(TypeHints.class)
    @Retention(RUNTIME)
    public @interface TypeHint
    Configure reflection or *.class resources access on specified types. Class references via the types() member are the preferred form of use but sometimes due to accessibility restrictions the type names may need to be specified in the typeNames() member. See access() for inferred type of access and how to customize it with AccessBits. It can be important to limit it to only what is necessary for an optimal compiled image size.
    Author:
    Andy Clement, Sebastien Deleuze
    See Also:
    Manual configuration of reflection use in native images
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      TypeAccess[] access
      Defined the scope of the reflection entries or resource access to be configured.
      FieldHint[] fields
      Specific fields information, useful to reduce the footprint impact of the generated configuration or to specify unsafe access.
      MethodHint[] methods
      Specific method information for reflective invocation and metadata query, useful to reduce the footprint impact of the generated configuration.
      MethodHint[] queriedMethods
      Specific method information for reflective metadata query, useful to reduce the footprint impact of the generated configuration.
      java.lang.String[] typeNames
      Alternative way to specify class references, should be used when type visibility prevents using Class references, or for nested types which should be specified using a $ separator (for example com.example.Foo$Bar).
      java.lang.Class<?>[] types
      Preferred (because typesafe) way to specify class references.
    • Element Detail

      • types

        java.lang.Class<?>[] types
        Preferred (because typesafe) way to specify class references.
        Returns:
        the types
        Default:
        {}
      • typeNames

        java.lang.String[] typeNames
        Alternative way to specify class references, should be used when type visibility prevents using Class references, or for nested types which should be specified using a $ separator (for example com.example.Foo$Bar).
        Returns:
        the type names
        Default:
        {}
      • access

        TypeAccess[] access
        Defined the scope of the reflection entries or resource access to be configured. Autodetected when not set, see TypeAccess.AUTO_DETECT related documentation.

        Use empty array ({code {}}) for class access only (to allow for example Class.forName(String)) with non-constant argument (with constant argument no need it is inlined at compile time).

        Returns:
        the type accesses
        Default:
        {org.springframework.nativex.hint.TypeAccess.AUTO_DETECT}
      • methods

        MethodHint[] methods
        Specific method information for reflective invocation and metadata query, useful to reduce the footprint impact of the generated configuration.
        Returns:
        the methods information
        Default:
        {}
      • queriedMethods

        MethodHint[] queriedMethods
        Specific method information for reflective metadata query, useful to reduce the footprint impact of the generated configuration.
        Returns:
        the methods information
        Default:
        {}
      • fields

        FieldHint[] fields
        Specific fields information, useful to reduce the footprint impact of the generated configuration or to specify unsafe access.
        Returns:
        the fields information
        Default:
        {}