@Internal public class JavaClassElement extends AbstractJavaElement implements ClassElement
TypeElement
.Modifier and Type | Field and Description |
---|---|
protected int |
arrayDimensions |
protected javax.lang.model.element.TypeElement |
classElement |
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
EMPTY
Constructor and Description |
---|
JavaClassElement(javax.lang.model.element.TypeElement classElement,
AnnotationMetadata annotationMetadata,
JavaVisitorContext visitorContext) |
Modifier and Type | Method and Description |
---|---|
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.
|
java.util.List<FieldElement> |
getFields(java.util.function.Predicate<java.util.Set<ElementModifier>> modifierFilter)
Return fields contained with the given modifiers include / exclude rules.
|
java.lang.String |
getName() |
java.util.Optional<MethodElement> |
getPrimaryConstructor()
Find and return a single primary constructor.
|
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(java.lang.String type)
Tests whether one type is assignable to another.
|
boolean |
isInterface() |
boolean |
isPrimitive()
Whether the type is primitive.
|
ClassElement |
toArray()
Convert the class element to an element for the same type, but representing an array.
|
annotate, getAnnotationMetadata, getNativeType, isFinal, isPrivate, isProtected, isPublic, isStatic, mirrorToClassElement, mirrorToClassElement, parameterizedClassElement, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFields, getFirstTypeArgument, getPackageName, getSimpleName, getType, getTypeArguments, isAssignable, isEnum, isIterable
getGenericType
annotate, annotate, annotate, annotate, getDocumentation, getNativeType, isFinal, isPrivate, isProtected, isPublic, isStatic
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, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, 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, 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, synthesizeDeclaredAnnotationsByType
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
getAnnotationMetadata
protected final javax.lang.model.element.TypeElement classElement
protected int arrayDimensions
@Internal public JavaClassElement(javax.lang.model.element.TypeElement classElement, AnnotationMetadata annotationMetadata, JavaVisitorContext visitorContext)
classElement
- The TypeElement
annotationMetadata
- The annotation metadatavisitorContext
- The visitor context@NonNull public java.util.Map<java.lang.String,ClassElement> getTypeArguments(@NonNull java.lang.String type)
ClassElement
getTypeArguments
in interface ClassElement
type
- The type to retrieve type arguments forpublic boolean isPrimitive()
TypedElement
isPrimitive
in interface TypedElement
public java.util.Optional<ClassElement> getSuperType()
ClassElement
getSuperType
in interface ClassElement
public boolean isAbstract()
isAbstract
in interface Element
isAbstract
in class AbstractJavaElement
public boolean isInterface()
isInterface
in interface ClassElement
public java.util.List<PropertyElement> getBeanProperties()
ClassElement
getBeanProperties
in interface ClassElement
public java.util.List<FieldElement> getFields(@NonNull java.util.function.Predicate<java.util.Set<ElementModifier>> modifierFilter)
ClassElement
getFields
in interface ClassElement
modifierFilter
- Can be used to filter fields by modifierpublic boolean isArray()
TypedElement
isArray
in interface TypedElement
public int getArrayDimensions()
TypedElement
getArrayDimensions
in interface TypedElement
public ClassElement toArray()
ClassElement
toArray
in interface ClassElement
public java.lang.String getName()
public boolean isAssignable(java.lang.String type)
ClassElement
isAssignable
in interface ClassElement
type
- The type to checktrue
if and only if the this type is assignable to the second@NonNull public java.util.Optional<MethodElement> getPrimaryConstructor()
ClassElement
Creator
or Inject
.getPrimaryConstructor
in interface ClassElement
public java.util.Optional<MethodElement> getDefaultConstructor()
ClassElement
getDefaultConstructor
in interface ClassElement
@NonNull public java.util.Map<java.lang.String,ClassElement> getTypeArguments()
getTypeArguments
in interface ClassElement