Package io.micronaut.inject.ast
Class PrimitiveElement
- java.lang.Object
-
- io.micronaut.inject.ast.PrimitiveElement
-
- All Implemented Interfaces:
io.micronaut.core.annotation.AnnotatedElement
,io.micronaut.core.annotation.AnnotationMetadata
,io.micronaut.core.annotation.AnnotationMetadataDelegate
,io.micronaut.core.annotation.AnnotationMetadataProvider
,io.micronaut.core.annotation.AnnotationSource
,io.micronaut.core.naming.Described
,io.micronaut.core.naming.Named
,ArrayableClassElement
,ClassElement
,Element
,TypedElement
public final class PrimitiveElement extends java.lang.Object implements ArrayableClassElement
AClassElement
of primitive types.
-
-
Field Summary
Fields Modifier and Type Field Description static PrimitiveElement
BOOLEAN
static PrimitiveElement
BYTE
static PrimitiveElement
CHAR
static PrimitiveElement
DOUBLE
static PrimitiveElement
FLOAT
static PrimitiveElement
INT
static PrimitiveElement
LONG
static PrimitiveElement
SHORT
static PrimitiveElement
VOID
-
Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
-
Fields inherited from interface io.micronaut.inject.ast.ClassElement
ZERO_CLASS_ELEMENTS
-
Fields inherited from interface io.micronaut.inject.ast.Element
EMPTY_ELEMENT_ARRAY
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.micronaut.core.annotation.AnnotationMetadata
getAnnotationMetadata()
int
getArrayDimensions()
If the type is an array, the number of dimensions.java.lang.String
getName()
java.lang.Object
getNativeType()
Returns the native underlying type.boolean
isArray()
Is the type an array.boolean
isAssignable(ClassElement type)
Tests whether one type is assignable to another.boolean
isAssignable(java.lang.String type)
Tests whether one type is assignable to another.boolean
isPrimitive()
Whether the type is primitive.boolean
isProtected()
boolean
isPublic()
static PrimitiveElement
valueOf(java.lang.String name)
ClassElement
withArrayDimensions(int arrayDimensions)
Convert the class element to an element for the same type, but with the given number of array dimensions.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.micronaut.core.annotation.AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
getAnnotationValuesByName, getAnnotationValuesByStereotype, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresent
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasPropertyExpressions, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
-
Methods inherited from interface io.micronaut.inject.ast.ArrayableClassElement
fromArray, toArray
-
Methods inherited from interface io.micronaut.inject.ast.ClassElement
addAssociatedBean, foldBoundGenericTypes, getAllTypeArguments, getBeanProperties, getBoundGenericTypes, getCanonicalName, getDeclaredGenericPlaceholders, getDefaultConstructor, getEnclosedElement, getEnclosedElements, getEnclosingType, getFields, getFields, getFirstTypeArgument, getInterfaces, getPackage, getPackageName, getPrimaryConstructor, getRawClassElement, getSimpleName, getSuperType, getType, getTypeArguments, getTypeArguments, getTypeArguments, isAssignable, isEnum, isGenericPlaceholder, isInner, isInterface, isIterable, isOptional, isProxy, isRecord, isTypeVariable, isWildcard, withBoundGenericTypes
-
Methods inherited from interface io.micronaut.inject.ast.Element
annotate, annotate, annotate, annotate, annotate, getDescription, getDescription, getDocumentation, getModifiers, isAbstract, isFinal, isPackagePrivate, isPrivate, isStatic, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotype
-
Methods inherited from interface io.micronaut.inject.ast.TypedElement
getGenericType
-
-
-
-
Field Detail
-
VOID
public static final PrimitiveElement VOID
-
BOOLEAN
public static final PrimitiveElement BOOLEAN
-
INT
public static final PrimitiveElement INT
-
CHAR
public static final PrimitiveElement CHAR
-
LONG
public static final PrimitiveElement LONG
-
FLOAT
public static final PrimitiveElement FLOAT
-
DOUBLE
public static final PrimitiveElement DOUBLE
-
SHORT
public static final PrimitiveElement SHORT
-
BYTE
public static final PrimitiveElement BYTE
-
-
Method Detail
-
isAssignable
public boolean isAssignable(java.lang.String type)
Description copied from interface:ClassElement
Tests whether one type is assignable to another.- Specified by:
isAssignable
in interfaceClassElement
- 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 interfaceClassElement
- 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 interfaceTypedElement
- 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 interfaceTypedElement
- Returns:
- The number of dimensions
-
getName
@NonNull public java.lang.String getName()
-
isProtected
public boolean isProtected()
- Specified by:
isProtected
in interfaceElement
- Returns:
- True if the element is protected.
-
isPublic
public boolean isPublic()
-
getNativeType
@NonNull public java.lang.Object getNativeType()
Description copied from interface:Element
Returns the native underlying type. This API is extended by all of the 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 interfaceElement
- Returns:
- The native type
-
getAnnotationMetadata
public io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
- Specified by:
getAnnotationMetadata
in interfaceio.micronaut.core.annotation.AnnotationMetadataProvider
-
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 interfaceArrayableClassElement
- 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 interfaceTypedElement
- Returns:
- True if it is
-
valueOf
public static PrimitiveElement valueOf(java.lang.String name)
-
-