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
isDeprecated
(io.micronaut.inject.ast.Element el) static boolean
isEnum
(io.micronaut.inject.ast.ClassElement classElement) static boolean
isExtraBodyParameter
(@NonNull io.micronaut.inject.ast.TypedElement parameter, boolean permitsRequestBody, List<io.micronaut.http.uri.UriMatchTemplate> matchTemplates, Map<String, io.micronaut.http.uri.UriMatchVariable> pathVariables, Map<String, io.micronaut.http.uri.UriMatchVariable> queryParams) static boolean
isFileUpload
(io.micronaut.inject.ast.ClassElement type) Checking if the type is file upload type.static boolean
isIgnoredParameter
(@NonNull io.micronaut.inject.ast.TypedElement parameter) static boolean
isIgnoredParameterType
(io.micronaut.inject.ast.ClassElement parameterType) static boolean
isJavaBasicType
(String typeName) static boolean
isJavaUtilCollectionType
(io.micronaut.inject.ast.ClassElement classEl) static boolean
isJavaUtilType
(io.micronaut.inject.ast.ClassElement classEl) 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 boolean
isWrappedBodyParameter
(@NonNull io.micronaut.inject.ast.TypedElement parameter) 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
-
isJavaUtilType
public static boolean isJavaUtilType(io.micronaut.inject.ast.ClassElement classEl) -
isJavaUtilCollectionType
public static boolean isJavaUtilCollectionType(io.micronaut.inject.ast.ClassElement classEl) -
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
-
isWrappedBodyParameter
public static boolean isWrappedBodyParameter(@NonNull @NonNull io.micronaut.inject.ast.TypedElement parameter) -
isExtraBodyParameter
public static boolean isExtraBodyParameter(@NonNull @NonNull io.micronaut.inject.ast.TypedElement parameter, boolean permitsRequestBody, List<io.micronaut.http.uri.UriMatchTemplate> matchTemplates, Map<String, io.micronaut.http.uri.UriMatchVariable> pathVariables, Map<String, io.micronaut.http.uri.UriMatchVariable> queryParams) -
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
-
isJavaBasicType
-
isIgnoredParameter
public static boolean isIgnoredParameter(@NonNull @NonNull io.micronaut.inject.ast.TypedElement parameter) -
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) -
isDeprecated
public static boolean isDeprecated(io.micronaut.inject.ast.Element el) -
isEnum
public static boolean isEnum(io.micronaut.inject.ast.ClassElement classElement)
-