Class Annotations

java.lang.Object
io.smallrye.graphql.schema.Annotations

public class Annotations extends Object
All the annotations we care about for a certain context

There are multiple static methods to create the annotations for the correct context

Author:
Phillip Kruger (phillip.kruger@redhat.com)
  • Field Details

    • parentAnnotations

      public final Map<org.jboss.jandex.DotName,org.jboss.jandex.AnnotationInstance> parentAnnotations
    • REPEATABLE

      public static final org.jboss.jandex.DotName REPEATABLE
    • BLOCKING

      public static final org.jboss.jandex.DotName BLOCKING
    • NON_BLOCKING

      public static final org.jboss.jandex.DotName NON_BLOCKING
    • TO_SCALAR

      public static final org.jboss.jandex.DotName TO_SCALAR
    • CUSTOM_SCALAR

      public static final org.jboss.jandex.DotName CUSTOM_SCALAR
    • ADAPT_TO_SCALAR

      public static final org.jboss.jandex.DotName ADAPT_TO_SCALAR
    • ADAPT_WITH

      public static final org.jboss.jandex.DotName ADAPT_WITH
    • ERROR_CODE

      public static final org.jboss.jandex.DotName ERROR_CODE
    • DATAFETCHER

      public static final org.jboss.jandex.DotName DATAFETCHER
    • SUBCRIPTION

      public static final org.jboss.jandex.DotName SUBCRIPTION
    • RESOLVER

      public static final org.jboss.jandex.DotName RESOLVER
    • DIRECTIVE

      public static final org.jboss.jandex.DotName DIRECTIVE
    • DEFAULT_NON_NULL

      public static final org.jboss.jandex.DotName DEFAULT_NON_NULL
    • NULLABLE

      public static final org.jboss.jandex.DotName NULLABLE
    • KOTLIN_METADATA

      public static final org.jboss.jandex.DotName KOTLIN_METADATA
    • ONE_OF

      public static final org.jboss.jandex.DotName ONE_OF
    • NAMESPACE

      public static final org.jboss.jandex.DotName NAMESPACE
    • GRAPHQL_API

      public static final org.jboss.jandex.DotName GRAPHQL_API
    • QUERY

      public static final org.jboss.jandex.DotName QUERY
    • MUTATION

      public static final org.jboss.jandex.DotName MUTATION
    • INPUT

      public static final org.jboss.jandex.DotName INPUT
    • TYPE

      public static final org.jboss.jandex.DotName TYPE
    • INTERFACE

      public static final org.jboss.jandex.DotName INTERFACE
    • UNION

      public static final org.jboss.jandex.DotName UNION
    • ENUM

      public static final org.jboss.jandex.DotName ENUM
    • ID

      public static final org.jboss.jandex.DotName ID
    • DESCRIPTION

      public static final org.jboss.jandex.DotName DESCRIPTION
    • DATE_FORMAT

      public static final org.jboss.jandex.DotName DATE_FORMAT
    • NUMBER_FORMAT

      public static final org.jboss.jandex.DotName NUMBER_FORMAT
    • DEFAULT_VALUE

      public static final org.jboss.jandex.DotName DEFAULT_VALUE
    • IGNORE

      public static final org.jboss.jandex.DotName IGNORE
    • NON_NULL

      public static final org.jboss.jandex.DotName NON_NULL
    • NAME

      public static final org.jboss.jandex.DotName NAME
    • SOURCE

      public static final org.jboss.jandex.DotName SOURCE
    • JAVAX_JSONB

      public static final String JAVAX_JSONB
      See Also:
    • JAVAX_JSONB_DATE_FORMAT

      public static final org.jboss.jandex.DotName JAVAX_JSONB_DATE_FORMAT
    • JAVAX_JSONB_NUMBER_FORMAT

      public static final org.jboss.jandex.DotName JAVAX_JSONB_NUMBER_FORMAT
    • JAVAX_JSONB_PROPERTY

      public static final org.jboss.jandex.DotName JAVAX_JSONB_PROPERTY
    • JAVAX_JSONB_TRANSIENT

      public static final org.jboss.jandex.DotName JAVAX_JSONB_TRANSIENT
    • JAVAX_JSONB_CREATOR

      public static final org.jboss.jandex.DotName JAVAX_JSONB_CREATOR
    • JAVAX_JSONB_TYPE_ADAPTER

      public static final org.jboss.jandex.DotName JAVAX_JSONB_TYPE_ADAPTER
    • JAKARTA_JSONB

      public static final String JAKARTA_JSONB
      See Also:
    • JAKARTA_JSONB_DATE_FORMAT

      public static final org.jboss.jandex.DotName JAKARTA_JSONB_DATE_FORMAT
    • JAKARTA_JSONB_NUMBER_FORMAT

      public static final org.jboss.jandex.DotName JAKARTA_JSONB_NUMBER_FORMAT
    • JAKARTA_JSONB_PROPERTY

      public static final org.jboss.jandex.DotName JAKARTA_JSONB_PROPERTY
    • JAKARTA_JSONB_TRANSIENT

      public static final org.jboss.jandex.DotName JAKARTA_JSONB_TRANSIENT
    • JAKARTA_JSONB_CREATOR

      public static final org.jboss.jandex.DotName JAKARTA_JSONB_CREATOR
    • JAKARTA_JSONB_TYPE_ADAPTER

      public static final org.jboss.jandex.DotName JAKARTA_JSONB_TYPE_ADAPTER
    • JACKSON_IGNORE

      public static final org.jboss.jandex.DotName JACKSON_IGNORE
    • JACKSON_PROPERTY

      public static final org.jboss.jandex.DotName JACKSON_PROPERTY
    • JACKSON_CREATOR

      public static final org.jboss.jandex.DotName JACKSON_CREATOR
    • JACKSON_FORMAT

      public static final org.jboss.jandex.DotName JACKSON_FORMAT
    • JAVAX_BEAN_VALIDATION_NOT_NULL

      public static final org.jboss.jandex.DotName JAVAX_BEAN_VALIDATION_NOT_NULL
    • JAVAX_BEAN_VALIDATION_NOT_EMPTY

      public static final org.jboss.jandex.DotName JAVAX_BEAN_VALIDATION_NOT_EMPTY
    • JAVAX_BEAN_VALIDATION_NOT_BLANK

      public static final org.jboss.jandex.DotName JAVAX_BEAN_VALIDATION_NOT_BLANK
    • JAKARTA_BEAN_VALIDATION_NOT_NULL

      public static final org.jboss.jandex.DotName JAKARTA_BEAN_VALIDATION_NOT_NULL
    • JAKARTA_BEAN_VALIDATION_NOT_EMPTY

      public static final org.jboss.jandex.DotName JAKARTA_BEAN_VALIDATION_NOT_EMPTY
    • JAKARTA_BEAN_VALIDATION_NOT_BLANK

      public static final org.jboss.jandex.DotName JAKARTA_BEAN_VALIDATION_NOT_BLANK
    • KOTLIN_NOT_NULL

      public static final org.jboss.jandex.DotName KOTLIN_NOT_NULL
  • Method Details

    • getAnnotationsForMethod

      public static Annotations getAnnotationsForMethod(org.jboss.jandex.MethodInfo methodInfo)
      Get used when creating operations. Operation only have methods (no properties)
      Parameters:
      methodInfo - the java method
      Returns:
      Annotations for this method and its return-type
    • getAnnotationsForInterfaceField

      public static Annotations getAnnotationsForInterfaceField(org.jboss.jandex.MethodInfo methodInfo)
      Get used when creating fields on interfaces. Interfaces only has methods, no properties
      Parameters:
      methodInfo - the java method
      Returns:
      Annotations for this method
    • getAnnotationsForPojo

      public static Annotations getAnnotationsForPojo(Direction direction, org.jboss.jandex.FieldInfo fieldInfo)
      Get used when creating fields on inputs and types. This is used for public fields
      Parameters:
      direction - the direction
      fieldInfo - the java property
      Returns:
      annotations for this field
    • getAnnotationsForPojo

      public static Annotations getAnnotationsForPojo(Direction direction, org.jboss.jandex.FieldInfo fieldInfo, org.jboss.jandex.MethodInfo methodInfo)
      Get used when creating fields on inputs and types. Both has properties and methods and this needs to combined the two
      Parameters:
      direction - the direction
      fieldInfo - the java property
      methodInfo - the java method
      Returns:
      annotations for this field
    • getAnnotationsForInputCreator

      public static Annotations getAnnotationsForInputCreator(org.jboss.jandex.MethodInfo method, short position, org.jboss.jandex.FieldInfo fieldInfo)
    • getAnnotationsForClass

      public static Annotations getAnnotationsForClass(org.jboss.jandex.ClassInfo classInfo)
      Get used when we create types and references to them

      Class level annotation for type creation.

      Parameters:
      classInfo - the java class
      Returns:
      annotation for this class
    • getAnnotationsForArray

      public static Annotations getAnnotationsForArray(org.jboss.jandex.Type typeInCollection, org.jboss.jandex.Type methodTypeInCollection)
      Get used when creating arrays.

      This will contains the annotation on the collection field and method

      Parameters:
      typeInCollection - the field java type
      methodTypeInCollection - the method java type
      Returns:
      the annotation for this array
    • getAnnotationsForArgument

      public static Annotations getAnnotationsForArgument(org.jboss.jandex.MethodInfo methodInfo, short pos)
      Used when we are creating operation and arguments for these operations
      Parameters:
      methodInfo - the java method
      pos - the argument position
      Returns:
      annotation for this argument
    • isJsonBAnnotation

      public static boolean isJsonBAnnotation(org.jboss.jandex.AnnotationInstance instance)
    • getAnnotationNames

      public Set<org.jboss.jandex.DotName> getAnnotationNames()
    • removeAnnotations

      public Annotations removeAnnotations(org.jboss.jandex.DotName... annotations)
    • getAnnotationValue

      public org.jboss.jandex.AnnotationValue getAnnotationValue(org.jboss.jandex.DotName annotation)
      Get a specific annotation
      Parameters:
      annotation - the annotation you want
      Returns:
      the annotation value or null
    • getAnnotationValue

      public org.jboss.jandex.AnnotationValue getAnnotationValue(org.jboss.jandex.DotName annotation, String name)
      Get a specific annotation
      Parameters:
      annotation - the annotation you want
      Returns:
      the annotation value or null
    • containsKeyAndValidValue

      public boolean containsKeyAndValidValue(org.jboss.jandex.DotName annotation)
      Check if there is an annotation and it has a valid value
      Parameters:
      annotation - the annotation we are checking
      Returns:
      true if valid value
    • containsOneOfTheseAnnotations

      public boolean containsOneOfTheseAnnotations(org.jboss.jandex.DotName... annotations)
      Check if one of these annotations is present
      Parameters:
      annotations - the annotations to check
      Returns:
      true if it does
    • containsOneOfTheseInheritableAnnotations

      public boolean containsOneOfTheseInheritableAnnotations(org.jboss.jandex.DotName... annotations)
    • getOneOfTheseAnnotations

      public Optional<org.jboss.jandex.AnnotationInstance> getOneOfTheseAnnotations(org.jboss.jandex.DotName... annotations)
      Get on of these annotations
      Parameters:
      annotations - the annotations to check (in order)
      Returns:
      the annotation potentially or empty if not found
    • getOneOfTheseAnnotationsValue

      public Optional<String> getOneOfTheseAnnotationsValue(org.jboss.jandex.DotName... annotations)
      This go through a list of annotations and find the first one that has a valid value. If it could not find one, it return empty
      Parameters:
      annotations - the annotations in order
      Returns:
      the valid annotation value or default value
    • getOneOfTheseMethodAnnotationsValue

      public Optional<String> getOneOfTheseMethodAnnotationsValue(org.jboss.jandex.DotName... annotations)
      This go through a list of method annotations and find the first one that has a valid value. If it could not find one, it return the default value.
      Parameters:
      annotations - the annotations in order
      Returns:
      the valid annotation value or empty
    • getOneOfTheseMethodParameterAnnotationsValue

      public Optional<String> getOneOfTheseMethodParameterAnnotationsValue(org.jboss.jandex.DotName... annotations)
      This go through a list of method parameter annotations and find the first one that has a valid value. If it could not find one, it return the default value.
      Parameters:
      annotations - the annotations in order
      Returns:
      the valid annotation value or empty
    • resolve

      public Stream<org.jboss.jandex.AnnotationInstance> resolve(org.jboss.jandex.DotName name)
      Get a stream of that annotation, maybe empty if not present, maybe a stream of one, or maybe several, if it's repeatable.
    • toString

      public String toString()
      Overrides:
      toString in class Object