Interface ConstructorUtils
-
-
Method Summary
Static Methods Modifier and Type Method Description static java.util.List<javax.lang.model.element.ExecutableElement>filterDeclaredConstructors(javax.lang.model.type.TypeMirror type, java.util.function.Predicate<? super javax.lang.model.element.ExecutableElement>... constructorFilters)Filters and retrieves the list of declared constructors from the providedTypeMirror.static javax.lang.model.element.ExecutableElementfindConstructor(javax.lang.model.element.TypeElement type, java.lang.reflect.Type... parameterTypes)Finds a declared constructor in the specifiedTypeElementthat matches the given parameter types.static javax.lang.model.element.ExecutableElementfindConstructor(javax.lang.model.type.TypeMirror type, java.lang.reflect.Type... parameterTypes)Finds a declared constructor in the specifiedTypeMirrorthat matches the given parameter types.static java.util.List<javax.lang.model.element.ExecutableElement>findDeclaredConstructors(javax.lang.model.element.TypeElement type, java.util.function.Predicate<? super javax.lang.model.element.ExecutableElement>... constructorFilters)Retrieves and filters the list of declared constructors from the providedTypeElement.static java.util.List<javax.lang.model.element.ExecutableElement>findDeclaredConstructors(javax.lang.model.type.TypeMirror type, java.util.function.Predicate<? super javax.lang.model.element.ExecutableElement>... constructorFilters)Retrieves and filters the list of declared constructors from the providedTypeMirror.static java.util.List<javax.lang.model.element.ExecutableElement>getDeclaredConstructors(javax.lang.model.element.TypeElement type)Retrieves the list of declared constructors from the providedTypeElement.static java.util.List<javax.lang.model.element.ExecutableElement>getDeclaredConstructors(javax.lang.model.type.TypeMirror type)Retrieves the list of declared constructors from the providedTypeMirror.
-
-
-
Method Detail
-
getDeclaredConstructors
static java.util.List<javax.lang.model.element.ExecutableElement> getDeclaredConstructors(javax.lang.model.element.TypeElement type)
Retrieves the list of declared constructors from the providedTypeElement.This method provides a null-safe way to obtain the constructors of a given type. If the input
typeisnull, an empty list is returned.- Parameters:
type- theTypeElementrepresenting the type to retrieve constructors from- Returns:
- a
ListofExecutableElementobjects representing the declared constructors; nevernull, but may be empty if no constructors are found or if the input isnull
-
getDeclaredConstructors
static java.util.List<javax.lang.model.element.ExecutableElement> getDeclaredConstructors(javax.lang.model.type.TypeMirror type)
Retrieves the list of declared constructors from the providedTypeMirror.This method provides a null-safe way to obtain the constructors of a given type. If the input
typeisnull, an empty list is returned.- Parameters:
type- theTypeMirrorrepresenting the type to retrieve constructors from- Returns:
- a
ListofExecutableElementobjects representing the declared constructors; nevernull, but may be empty if no constructors are found or if the input isnull
-
findConstructor
static javax.lang.model.element.ExecutableElement findConstructor(javax.lang.model.element.TypeElement type, java.lang.reflect.Type... parameterTypes)Finds a declared constructor in the specifiedTypeElementthat matches the given parameter types.This method provides a null-safe way to locate a constructor based on its parameter types. If the input
typeisnull, or no matching constructor is found,nullis returned.- Parameters:
type- theTypeElementrepresenting the type to search for constructorsparameterTypes- the array ofTypeobjects representing the parameter types to match- Returns:
- the matched
ExecutableElementrepresenting the constructor; may benull
-
findConstructor
static javax.lang.model.element.ExecutableElement findConstructor(javax.lang.model.type.TypeMirror type, java.lang.reflect.Type... parameterTypes)Finds a declared constructor in the specifiedTypeMirrorthat matches the given parameter types.This method provides a null-safe way to locate a constructor based on its parameter types. If the input
typeisnull, or no matching constructor is found,nullis returned.- Parameters:
type- theTypeMirrorrepresenting the type to search for constructorsparameterTypes- the array ofTypeobjects representing the parameter types to match- Returns:
- the matched
ExecutableElementrepresenting the constructor; may benull
-
findDeclaredConstructors
static java.util.List<javax.lang.model.element.ExecutableElement> findDeclaredConstructors(javax.lang.model.element.TypeElement type, java.util.function.Predicate<? super javax.lang.model.element.ExecutableElement>... constructorFilters)Retrieves and filters the list of declared constructors from the providedTypeElement.This method provides a null-safe way to obtain the constructors of a given type. If the input
typeisnull, an empty list is returned. The provided filters can be used to selectively include only those constructors that match the criteria.- Parameters:
type- theTypeElementrepresenting the type to retrieve constructors fromconstructorFilters- optional predicates to filter the constructors; if none are provided, all constructors are included- Returns:
- a
ListofExecutableElementobjects representing the filtered declared constructors; nevernull, but may be empty if no matching constructors are found or if the input isnull
-
findDeclaredConstructors
static java.util.List<javax.lang.model.element.ExecutableElement> findDeclaredConstructors(javax.lang.model.type.TypeMirror type, java.util.function.Predicate<? super javax.lang.model.element.ExecutableElement>... constructorFilters)Retrieves and filters the list of declared constructors from the providedTypeMirror.This method provides a null-safe way to obtain the constructors of a given type. If the input
typeisnull, an empty list is returned. The provided filters can be used to selectively include only those constructors that match the criteria.- Parameters:
type- theTypeMirrorrepresenting the type to retrieve constructors fromconstructorFilters- optional predicates to filter the constructors; if none are provided, all constructors are included- Returns:
- a
ListofExecutableElementobjects representing the filtered declared constructors; nevernull, but may be empty if no matching constructors are found or if the input isnull
-
filterDeclaredConstructors
static java.util.List<javax.lang.model.element.ExecutableElement> filterDeclaredConstructors(javax.lang.model.type.TypeMirror type, java.util.function.Predicate<? super javax.lang.model.element.ExecutableElement>... constructorFilters)Filters and retrieves the list of declared constructors from the providedTypeMirror.This method is responsible for extracting all declared constructors from the given type and applying the specified filters to narrow down the results. If the input
typeisnull, an empty list is returned.- Parameters:
type- theTypeMirrorrepresenting the type to retrieve constructors fromconstructorFilters- optional predicates to filter the constructors; if none are provided, all constructors are included- Returns:
- a
ListofExecutableElementobjects representing the filtered declared constructors; nevernull, but may be empty if no matching constructors are found or if the input isnull
-
-