public interface ClassElement extends TypedElement
EMPTY_ELEMENT_ARRAYCLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBEREMPTY| Modifier and Type | Method and Description |
|---|---|
ClassElement |
fromArray()
Dereference a class element denoting an array type by converting it to its element type.
|
default 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.
|
default java.util.List<PropertyElement> |
getBeanProperties()
Returns the bean properties (getters and setters) for this class element.
|
default java.lang.String |
getCanonicalName()
This method will return the name of the underlying type automatically unwrapping in the case of an optional
or wrapped representation of the type.
|
default java.util.Optional<MethodElement> |
getDefaultConstructor()
Find and return a single default constructor.
|
default <T extends Element> |
getEnclosedElement(ElementQuery<T> query)
Return the first enclosed element matching the given query.
|
default <T extends Element> |
getEnclosedElements(ElementQuery<T> query)
Return the elements that match the given query.
|
default java.util.List<FieldElement> |
getFields()
Return all the fields of this class element.
|
default java.util.List<FieldElement> |
getFields(java.util.function.Predicate<java.util.Set<ElementModifier>> modifierFilter)
Deprecated.
Use
getEnclosedElements(ElementQuery) instead |
default java.util.Optional<ClassElement> |
getFirstTypeArgument() |
default java.lang.String |
getPackageName()
The package name.
|
default java.util.Optional<MethodElement> |
getPrimaryConstructor()
Find and return a single primary constructor.
|
default java.lang.String |
getSimpleName()
The simple name without the package name.
|
default java.util.Optional<ClassElement> |
getSuperType()
Returns the super type of this element or empty if the element has no super type.
|
default ClassElement |
getType() |
default java.util.Map<java.lang.String,ClassElement> |
getTypeArguments() |
default java.util.Map<java.lang.String,ClassElement> |
getTypeArguments(java.lang.Class<?> type)
Get the type arguments for the given type name.
|
default java.util.Map<java.lang.String,ClassElement> |
getTypeArguments(java.lang.String type)
Get the type arguments for the given type name.
|
default boolean |
isAssignable(java.lang.Class<?> type)
Tests whether one type is assignable to another.
|
default 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.
|
default boolean |
isEnum()
Whether this element is an enum.
|
default boolean |
isInner()
Is this type an inner class.
|
default boolean |
isInterface() |
default boolean |
isIterable() |
default boolean |
isOptional()
Whether this element is an
Optional. |
default boolean |
isRecord() |
static ClassElement |
of(java.lang.Class<?> type)
Create a class element for the given simple type.
|
static ClassElement |
of(java.lang.String typeName)
Create a class element for the given simple type.
|
ClassElement |
toArray()
Convert the class element to an element for the same type, but representing an array.
|
getArrayDimensions, getGenericType, isArray, isPrimitiveannotate, annotate, annotate, annotate, getDocumentation, getName, getNativeType, isAbstract, 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, 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, isNullablegetAnnotationMetadataboolean isAssignable(java.lang.String type)
type - The type to checktrue if and only if the this type is assignable to the seconddefault boolean isAssignable(ClassElement type)
type - The type to checktrue if and only if the this type is assignable to the seconddefault boolean isOptional()
Optional.default java.lang.String getCanonicalName()
default boolean isRecord()
default boolean isInner()
default boolean isEnum()
@NonNull default java.util.Optional<MethodElement> getPrimaryConstructor()
Creator or Inject.@NonNull default java.util.Optional<MethodElement> getDefaultConstructor()
default java.util.Optional<ClassElement> getSuperType()
@NonNull default ClassElement getType()
getType in interface TypedElementdefault java.lang.String getSimpleName()
getSimpleName in interface Elementdefault java.lang.String getPackageName()
default java.util.List<PropertyElement> getBeanProperties()
default java.util.List<FieldElement> getFields()
@Deprecated default java.util.List<FieldElement> getFields(@NonNull java.util.function.Predicate<java.util.Set<ElementModifier>> modifierFilter)
getEnclosedElements(ElementQuery) insteadmodifierFilter - Can be used to filter fields by modifierdefault <T extends Element> java.util.List<T> getEnclosedElements(@NonNull ElementQuery<T> query)
T - The element typequery - The query to use.default <T extends Element> java.util.Optional<T> getEnclosedElement(@NonNull ElementQuery<T> query)
T - The element typequery - The query to use.default boolean isInterface()
default boolean isIterable()
@NonNull default java.util.Map<java.lang.String,ClassElement> getTypeArguments(@NonNull java.lang.String type)
type - The type to retrieve type arguments for@NonNull default java.util.Map<java.lang.String,ClassElement> getTypeArguments(@NonNull java.lang.Class<?> type)
type - The type to retrieve type arguments for@NonNull default java.util.Map<java.lang.String,ClassElement> getTypeArguments()
@NonNull default java.util.Map<java.lang.String,java.util.Map<java.lang.String,ClassElement>> getAllTypeArguments()
default java.util.Optional<ClassElement> getFirstTypeArgument()
default boolean isAssignable(java.lang.Class<?> type)
type - The type to checktrue if and only if the this type is assignable to the secondClassElement toArray()
ClassElement fromArray()
java.lang.IllegalStateException - if this class element doesn't denote an array typestatic ClassElement of(java.lang.Class<?> type)
type - The type@Internal static ClassElement of(java.lang.String typeName)
typeName - The type