Class PrimitiveElement

java.lang.Object
io.micronaut.inject.ast.PrimitiveElement
All Implemented Interfaces:
AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Named, MutableAnnotationMetadataDelegate<Element>, ArrayableClassElement, ClassElement, Element, TypedElement

public final class PrimitiveElement extends Object implements ArrayableClassElement
A ClassElement of primitive types.
  • Field Details

  • Method Details

    • isAssignable

      public boolean isAssignable(String type)
      Description copied from interface: ClassElement
      Tests whether one type is assignable to another.
      Specified by:
      isAssignable in interface ClassElement
      Parameters:
      type - The type to check
      Returns:
      true if and only if this type is assignable to the second
    • isAssignable

      public boolean isAssignable(ClassElement type)
      Description copied from interface: ClassElement
      Tests whether one type is assignable to another.
      Specified by:
      isAssignable in interface ClassElement
      Parameters:
      type - The type to check
      Returns:
      true if and only if this type is assignable to the second
    • isArray

      public boolean isArray()
      Description copied from interface: TypedElement
      Is the type an array.
      Specified by:
      isArray in interface TypedElement
      Returns:
      True if it is.
    • getArrayDimensions

      public int getArrayDimensions()
      Description copied from interface: TypedElement
      If the type is an array, the number of dimensions. String[] should return 1, String[][] should return 2
      Specified by:
      getArrayDimensions in interface TypedElement
      Returns:
      The number of dimensions
    • getName

      @NonNull public @NonNull String getName()
      Specified by:
      getName in interface Element
      Specified by:
      getName in interface Named
      Returns:
      The name of the element. For a type this represents the binary name.
    • isProtected

      public boolean isProtected()
      Specified by:
      isProtected in interface Element
      Returns:
      True if the element is protected.
    • isPublic

      public boolean isPublic()
      Specified by:
      isPublic in interface Element
      Returns:
      True if the element is public.
    • getNativeType

      @NonNull public @NonNull Object getNativeType()
      Description copied from interface: Element
      Returns the native underlying type. This API is extended by all inject language implementations. The object returned by this method will be the language native type the information is being retrieved from.
      Specified by:
      getNativeType in interface Element
      Returns:
      The native type
    • getAnnotationMetadata

      public AnnotationMetadata getAnnotationMetadata()
      Description copied from interface: AnnotationMetadataProvider
      Supplies the metadata. Defaults to AnnotationMetadata.EMPTY_METADATA.
      Specified by:
      getAnnotationMetadata in interface AnnotationMetadataProvider
      Returns:
      The AnnotationMetadata
    • withArrayDimensions

      public ClassElement withArrayDimensions(int arrayDimensions)
      Description copied from interface: ArrayableClassElement
      Convert the class element to an element for the same type, but with the given number of array dimensions. Do not mutate the existing instance. Create a new instance instead.
      Specified by:
      withArrayDimensions in interface ArrayableClassElement
      Parameters:
      arrayDimensions - The number of array dimensions of the new class element
      Returns:
      A new class element
    • isPrimitive

      public boolean isPrimitive()
      Description copied from interface: TypedElement
      Whether the type is primitive.
      Specified by:
      isPrimitive in interface TypedElement
      Returns:
      True if it is
    • isNonNull

      public boolean isNonNull()
      Specified by:
      isNonNull in interface AnnotatedElement
      Returns:
      Whether the element is declared as not being null
    • isNullable

      public boolean isNullable()
      Specified by:
      isNullable in interface AnnotatedElement
      Returns:
      Whether the element is nullable.
    • valueOf

      public static PrimitiveElement valueOf(String name)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object