Interface IAnnotationHandle

All Known Implementing Classes:
Annotations.Handle

public interface IAnnotationHandle
Interface for annotation handle since some classes may need to read info from both ASM AnnotationNodes at runtime and mirror annotations in the AP at compile time.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Get whether the annotation inside the handle actually exists, if the contained element is null, returns false.
    Get an annotation value as an annotation handle
    Retrieve an annotation key as a list of annotation handles
    boolean
    getBoolean(String key, boolean defaultValue)
    Get the primitive boolean value with the specified key or return null if not present or not set
    Get the annotation descriptor
    <T> List<T>
    Retrieve the annotation value as a list with values of the specified type.
    <T> List<T>
    Retrieve the annotation value with the specified key as a list with values of the specified type.
    List<org.objectweb.asm.Type>
    Retrieve an annotation key as a list of Types.
    org.objectweb.asm.Type
    Get an annotation value as an ASM Type.
    <T> T
    Get the annotation value or return null if not present or not set
    <T> T
    Get the annotation value with the specified key or return null if not present or not set
    <T> T
    getValue(String key, T defaultValue)
    Get a value with the specified key from this annotation, return the specified default value if the key is not set or is not present
  • Method Details

    • exists

      boolean exists()
      Get whether the annotation inside the handle actually exists, if the contained element is null, returns false.
      Returns:
      true if the annotation exists
    • getDesc

      String getDesc()
      Get the annotation descriptor
    • getAnnotationList

      List<IAnnotationHandle> getAnnotationList(String key)
      Retrieve an annotation key as a list of annotation handles
      Parameters:
      key - key to fetch
      Returns:
      list of annotations
    • getTypeValue

      org.objectweb.asm.Type getTypeValue(String key)
      Get an annotation value as an ASM Type. This is special-cased because the different APIs return class literals in different ways. Under ASM we will receieve Type instances, but at compile time we will get TypeMirrors instead. This overload is provided so that subclasses have to marshal everything into Type for consistency.
      Parameters:
      key - key to fetch
      Returns:
      value
    • getTypeList

      List<org.objectweb.asm.Type> getTypeList(String key)
      Retrieve an annotation key as a list of Types. This is special-cased because the different APIs return class literals in different ways. Under ASM we will receieve Type instances, but at compile time we will get TypeMirrors instead. This overload is provided so that subclasses have to marshal everything into Type for consistency.
      Parameters:
      key - key to fetch
      Returns:
      list of types
    • getAnnotation

      IAnnotationHandle getAnnotation(String key)
      Get an annotation value as an annotation handle
      Parameters:
      key - key to search for in the value map
      Returns:
      value or null if not set
    • getValue

      <T> T getValue(String key, T defaultValue)
      Get a value with the specified key from this annotation, return the specified default value if the key is not set or is not present
      Type Parameters:
      T - duck type
      Parameters:
      key - key
      defaultValue - value to return if the key is not set or not present
      Returns:
      value or default if not set
    • getValue

      <T> T getValue()
      Get the annotation value or return null if not present or not set
      Type Parameters:
      T - duck type
      Returns:
      value or null if not present or not set
    • getValue

      <T> T getValue(String key)
      Get the annotation value with the specified key or return null if not present or not set
      Type Parameters:
      T - duck type
      Parameters:
      key - key to fetch
      Returns:
      value or null if not present or not set
    • getBoolean

      boolean getBoolean(String key, boolean defaultValue)
      Get the primitive boolean value with the specified key or return null if not present or not set
      Parameters:
      key - key to fetch
      defaultValue - default value to return if value is not present
      Returns:
      value or default if not present or not set
    • getList

      <T> List<T> getList()
      Retrieve the annotation value as a list with values of the specified type. Returns an empty list if the value is not present or not set.
      Type Parameters:
      T - list element duck type
      Returns:
      list of values
    • getList

      <T> List<T> getList(String key)
      Retrieve the annotation value with the specified key as a list with values of the specified type. Returns an empty list if the value is not present or not set.
      Type Parameters:
      T - list element duck type
      Parameters:
      key - key to fetch
      Returns:
      list of values