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
AClassElementof primitive types.
-
-
Field Summary
Fields Modifier and Type Field Description static PrimitiveElementBOOLEANstatic PrimitiveElementBYTEstatic PrimitiveElementCHARstatic PrimitiveElementDOUBLEstatic PrimitiveElementFLOATstatic PrimitiveElementINTstatic PrimitiveElementLONGstatic PrimitiveElementSHORTstatic PrimitiveElementVOID-
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.AnnotationMetadatagetAnnotationMetadata()intgetArrayDimensions()If the type is an array, the number of dimensions.java.lang.StringgetName()java.lang.ObjectgetNativeType()Returns the native underlying type.booleanisArray()Is the type an array.booleanisAssignable(ClassElement type)Tests whether one type is assignable to another.booleanisAssignable(java.lang.String type)Tests whether one type is assignable to another.booleanisPrimitive()Whether the type is primitive.booleanisProtected()booleanisPublic()static PrimitiveElementvalueOf(java.lang.String name)ClassElementwithArrayDimensions(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:ClassElementTests whether one type is assignable to another.- Specified by:
isAssignablein interfaceClassElement- Parameters:
type- The type to check- Returns:
trueif and only if this type is assignable to the second
-
isAssignable
public boolean isAssignable(ClassElement type)
Description copied from interface:ClassElementTests whether one type is assignable to another.- Specified by:
isAssignablein interfaceClassElement- Parameters:
type- The type to check- Returns:
trueif and only if this type is assignable to the second
-
isArray
public boolean isArray()
Description copied from interface:TypedElementIs the type an array.- Specified by:
isArrayin interfaceTypedElement- Returns:
- True if it is.
-
getArrayDimensions
public int getArrayDimensions()
Description copied from interface:TypedElementIf the type is an array, the number of dimensions. String[] should return 1, String[][] should return 2- Specified by:
getArrayDimensionsin interfaceTypedElement- Returns:
- The number of dimensions
-
getName
@NonNull public java.lang.String getName()
-
isProtected
public boolean isProtected()
- Specified by:
isProtectedin interfaceElement- Returns:
- True if the element is protected.
-
isPublic
public boolean isPublic()
-
getNativeType
@NonNull public java.lang.Object getNativeType()
Description copied from interface:ElementReturns 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:
getNativeTypein interfaceElement- Returns:
- The native type
-
getAnnotationMetadata
public io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
- Specified by:
getAnnotationMetadatain interfaceio.micronaut.core.annotation.AnnotationMetadataProvider
-
withArrayDimensions
public ClassElement withArrayDimensions(int arrayDimensions)
Description copied from interface:ArrayableClassElementConvert 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:
withArrayDimensionsin 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:TypedElementWhether the type is primitive.- Specified by:
isPrimitivein interfaceTypedElement- Returns:
- True if it is
-
valueOf
public static PrimitiveElement valueOf(java.lang.String name)
-
-