Package io.micronaut.openapi.visitor
Class ElementUtils
java.lang.Object
io.micronaut.openapi.visitor.ElementUtils
Some util methods.
- Since:
- 4.8.3
-
Field Summary
Modifier and TypeFieldDescriptionstatic final io.micronaut.core.annotation.AnnotationValue<?>[]
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<io.micronaut.core.annotation.AnnotationValue<Annotation>>
findAnnotation
(io.micronaut.inject.ast.Element el, String annName) static <T extends Annotation>
io.micronaut.core.annotation.AnnotationValue<T>getAnnotation
(io.micronaut.inject.ast.Element el, Class<T> annClass) static io.micronaut.core.annotation.AnnotationValue
getAnnotation
(io.micronaut.inject.ast.Element el, String annName) static io.micronaut.core.annotation.AnnotationMetadata
getAnnotationMetadata
(io.micronaut.inject.ast.Element el) static io.micronaut.inject.ast.ClassElement
getJsonViewClass
(io.micronaut.inject.ast.Element element, io.micronaut.inject.visitor.VisitorContext context) static <T> boolean
isAnnotationPresent
(io.micronaut.inject.ast.Element el, Class<T> annClass) static boolean
isAnnotationPresent
(io.micronaut.inject.ast.Element el, String annName) static boolean
isContainerType
(io.micronaut.inject.ast.ClassElement type) Checking if the type is container.static boolean
isEnum
(io.micronaut.inject.ast.ClassElement classElement) static boolean
isFileUpload
(io.micronaut.inject.ast.ClassElement type) Checking if the type is file upload type.static boolean
isIgnoredParameter
(io.micronaut.inject.ast.TypedElement parameter) static boolean
isIgnoredParameterType
(io.micronaut.inject.ast.ClassElement parameterType) static boolean
isJavaBasicType
(String typeName) static boolean
isNotNullable
(io.micronaut.inject.ast.Element element) Checking if the element not nullable.static boolean
isNullable
(io.micronaut.inject.ast.TypedElement element) Checks Nullable annotations / optional type to understand that the element can be null.static boolean
isReactiveAndVoid
(io.micronaut.inject.ast.ClassElement type) Checking if the type is void.static boolean
isResponseType
(io.micronaut.inject.ast.ClassElement returnType) static boolean
isReturnTypeFile
(io.micronaut.inject.ast.ClassElement type) Checking if the type is file.static boolean
isSingleResponseType
(io.micronaut.inject.ast.ClassElement returnType) static boolean
isTypeWithGenericNullable
(io.micronaut.inject.ast.ClassElement type) static boolean
isVoid
(io.micronaut.inject.ast.ClassElement type) Checking if the type is void.static <T extends Annotation>
Optional<String>stringValue
(io.micronaut.inject.ast.Element el, Class<T> annClass, String member)
-
Field Details
-
EMPTY_ANNOTATION_VALUES_ARRAY
public static final io.micronaut.core.annotation.AnnotationValue<?>[] EMPTY_ANNOTATION_VALUES_ARRAY -
CONTAINER_TYPES
-
FILE_TYPES
-
VOID_TYPES
-
-
Method Details
-
isSingleResponseType
public static boolean isSingleResponseType(io.micronaut.inject.ast.ClassElement returnType) -
isResponseType
public static boolean isResponseType(io.micronaut.inject.ast.ClassElement returnType) -
isNullable
public static boolean isNullable(io.micronaut.inject.ast.TypedElement element) Checks Nullable annotations / optional type to understand that the element can be null.- Parameters:
element
- typed element- Returns:
- true if element is nullable, false - otherwise.
-
isFileUpload
public static boolean isFileUpload(io.micronaut.inject.ast.ClassElement type) Checking if the type is file upload type.- Parameters:
type
- type element- Returns:
- true if this type one of known file upload types
-
isNotNullable
public static boolean isNotNullable(io.micronaut.inject.ast.Element element) Checking if the element not nullable.- Parameters:
element
- element- Returns:
- true if element is not nullable
-
isReturnTypeFile
public static boolean isReturnTypeFile(io.micronaut.inject.ast.ClassElement type) Checking if the type is file.- Parameters:
type
- type element- Returns:
- true if this type assignable with known file types
-
isContainerType
public static boolean isContainerType(io.micronaut.inject.ast.ClassElement type) Checking if the type is container.- Parameters:
type
- type element- Returns:
- true if this type assignable with known container types
-
isVoid
public static boolean isVoid(io.micronaut.inject.ast.ClassElement type) Checking if the type is void.- Parameters:
type
- type element- Returns:
- true if this type assignable with known void types
-
isReactiveAndVoid
public static boolean isReactiveAndVoid(io.micronaut.inject.ast.ClassElement type) Checking if the type is void.- Parameters:
type
- type element- Returns:
- true if this type assignable with known container and type argument is void
-
isIgnoredParameter
public static boolean isIgnoredParameter(io.micronaut.inject.ast.TypedElement parameter) -
isJavaBasicType
-
isIgnoredParameterType
public static boolean isIgnoredParameterType(io.micronaut.inject.ast.ClassElement parameterType) -
getAnnotationMetadata
public static io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata(io.micronaut.inject.ast.Element el) -
findAnnotation
public static Optional<io.micronaut.core.annotation.AnnotationValue<Annotation>> findAnnotation(io.micronaut.inject.ast.Element el, String annName) -
isAnnotationPresent
public static <T> boolean isAnnotationPresent(io.micronaut.inject.ast.Element el, Class<T> annClass) -
isAnnotationPresent
-
stringValue
public static <T extends Annotation> Optional<String> stringValue(io.micronaut.inject.ast.Element el, Class<T> annClass, String member) -
getAnnotation
public static <T extends Annotation> io.micronaut.core.annotation.AnnotationValue<T> getAnnotation(io.micronaut.inject.ast.Element el, Class<T> annClass) -
getAnnotation
public static io.micronaut.core.annotation.AnnotationValue getAnnotation(io.micronaut.inject.ast.Element el, String annName) -
getJsonViewClass
public static io.micronaut.inject.ast.ClassElement getJsonViewClass(io.micronaut.inject.ast.Element element, io.micronaut.inject.visitor.VisitorContext context) -
isTypeWithGenericNullable
public static boolean isTypeWithGenericNullable(io.micronaut.inject.ast.ClassElement type) -
isEnum
public static boolean isEnum(io.micronaut.inject.ast.ClassElement classElement)
-