@Internal public class JavaClassElement extends AbstractJavaElement implements ArrayableClassElement
TypeElement.| Modifier and Type | Field and Description |
|---|---|
protected javax.lang.model.element.TypeElement |
classElement |
protected JavaVisitorContext |
visitorContext |
EMPTY_ELEMENT_ARRAYCLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBEREMPTY| Constructor and Description |
|---|
JavaClassElement(javax.lang.model.element.TypeElement classElement,
AnnotationMetadata annotationMetadata,
JavaVisitorContext visitorContext) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,ClassElement>> |
getAllTypeArguments()
Builds a map of all the type parameters for a class, its super classes and interfaces.
|
int |
getArrayDimensions()
If the type is an array, the number of dimensions.
|
java.util.List<PropertyElement> |
getBeanProperties()
Returns the bean properties (getters and setters) for this class element.
|
java.util.Optional<MethodElement> |
getDefaultConstructor()
Find and return a single default constructor.
|
<T extends Element> |
getEnclosedElements(ElementQuery<T> query)
Return the elements that match the given query.
|
java.lang.String |
getName() |
java.lang.String |
getPackageName()
The package name.
|
java.util.Optional<MethodElement> |
getPrimaryConstructor()
Find and return a single primary constructor.
|
java.lang.String |
getSimpleName()
The simple name without the package name.
|
java.util.Optional<ClassElement> |
getSuperType()
Returns the super type of this element or empty if the element has no super type.
|
java.util.Map<java.lang.String,ClassElement> |
getTypeArguments() |
java.util.Map<java.lang.String,ClassElement> |
getTypeArguments(java.lang.String type)
Get the type arguments for the given type name.
|
boolean |
isAbstract() |
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 |
isInner()
Is this type an inner class.
|
boolean |
isInterface() |
boolean |
isPrimitive()
Whether the type is primitive.
|
boolean |
isRecord() |
ClassElement |
withArrayDimensions(int arrayDimensions)
Convert the class element to an element for the same type, but with the given number of array dimensions.
|
annotate, getAnnotationMetadata, getNativeType, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, mirrorToClassElement, mirrorToClassElement, mirrorToClassElement, parameterizedClassElement, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfromArray, toArraygetCanonicalName, getEnclosedElement, getFields, getFields, getFirstTypeArgument, getType, getTypeArguments, isAssignable, isEnum, isIterable, isOptional, of, of, ofgetGenericTypeannotate, annotate, annotate, annotate, getDocumentation, getNativeType, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStaticbooleanValue, 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, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, 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, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByTypehasDeclaredStereotypeisDeclaredNonNull, isDeclaredNullable, isNonNull, isNullablegetAnnotationMetadataprotected final javax.lang.model.element.TypeElement classElement
protected final JavaVisitorContext visitorContext
@Internal public JavaClassElement(javax.lang.model.element.TypeElement classElement, AnnotationMetadata annotationMetadata, JavaVisitorContext visitorContext)
classElement - The TypeElementannotationMetadata - The annotation metadatavisitorContext - The visitor contextpublic boolean isInner()
ClassElementisInner in interface ClassElementpublic boolean isRecord()
isRecord in interface ClassElement@NonNull public java.util.Map<java.lang.String,ClassElement> getTypeArguments(@NonNull java.lang.String type)
ClassElementgetTypeArguments in interface ClassElementtype - The type to retrieve type arguments forpublic boolean isPrimitive()
TypedElementisPrimitive in interface TypedElementpublic java.util.Optional<ClassElement> getSuperType()
ClassElementgetSuperType in interface ClassElementpublic boolean isAbstract()
isAbstract in interface ElementisAbstract in class AbstractJavaElementpublic boolean isInterface()
isInterface in interface ClassElementpublic java.util.List<PropertyElement> getBeanProperties()
ClassElementgetBeanProperties in interface ClassElementpublic <T extends Element> java.util.List<T> getEnclosedElements(@NonNull ElementQuery<T> query)
ClassElementgetEnclosedElements in interface ClassElementT - The element typequery - The query to use.public boolean isArray()
TypedElementisArray in interface TypedElementpublic int getArrayDimensions()
TypedElementgetArrayDimensions in interface TypedElementpublic ClassElement withArrayDimensions(int arrayDimensions)
ArrayableClassElementwithArrayDimensions in interface ArrayableClassElementarrayDimensions - The number of array dimensions of the new class elementpublic java.lang.String getSimpleName()
ClassElementgetSimpleName in interface ClassElementgetSimpleName in interface Elementpublic java.lang.String getName()
public java.lang.String getPackageName()
ClassElementgetPackageName in interface ClassElementpublic boolean isAssignable(java.lang.String type)
ClassElementisAssignable in interface ClassElementtype - The type to checktrue if and only if the this type is assignable to the secondpublic boolean isAssignable(ClassElement type)
ClassElementisAssignable in interface ClassElementtype - The type to checktrue if and only if the this type is assignable to the second@NonNull public java.util.Optional<MethodElement> getPrimaryConstructor()
ClassElementCreator or Inject.getPrimaryConstructor in interface ClassElementpublic java.util.Optional<MethodElement> getDefaultConstructor()
ClassElementgetDefaultConstructor in interface ClassElement@NonNull public java.util.Map<java.lang.String,ClassElement> getTypeArguments()
getTypeArguments in interface ClassElement@NonNull public java.util.Map<java.lang.String,java.util.Map<java.lang.String,ClassElement>> getAllTypeArguments()
ClassElementgetAllTypeArguments in interface ClassElement