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.ExecutableElement
findConstructor(javax.lang.model.element.TypeElement type, java.lang.reflect.Type... parameterTypes)
Finds a declared constructor in the specifiedTypeElement
that matches the given parameter types.static javax.lang.model.element.ExecutableElement
findConstructor(javax.lang.model.type.TypeMirror type, java.lang.reflect.Type... parameterTypes)
Finds a declared constructor in the specifiedTypeMirror
that 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
type
isnull
, an empty list is returned.- Parameters:
type
- theTypeElement
representing the type to retrieve constructors from- Returns:
- a
List
ofExecutableElement
objects 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
type
isnull
, an empty list is returned.- Parameters:
type
- theTypeMirror
representing the type to retrieve constructors from- Returns:
- a
List
ofExecutableElement
objects 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 specifiedTypeElement
that matches the given parameter types.This method provides a null-safe way to locate a constructor based on its parameter types. If the input
type
isnull
, or no matching constructor is found,null
is returned.- Parameters:
type
- theTypeElement
representing the type to search for constructorsparameterTypes
- the array ofType
objects representing the parameter types to match- Returns:
- the matched
ExecutableElement
representing 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 specifiedTypeMirror
that matches the given parameter types.This method provides a null-safe way to locate a constructor based on its parameter types. If the input
type
isnull
, or no matching constructor is found,null
is returned.- Parameters:
type
- theTypeMirror
representing the type to search for constructorsparameterTypes
- the array ofType
objects representing the parameter types to match- Returns:
- the matched
ExecutableElement
representing 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
type
isnull
, an empty list is returned. The provided filters can be used to selectively include only those constructors that match the criteria.- Parameters:
type
- theTypeElement
representing the type to retrieve constructors fromconstructorFilters
- optional predicates to filter the constructors; if none are provided, all constructors are included- Returns:
- a
List
ofExecutableElement
objects 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
type
isnull
, an empty list is returned. The provided filters can be used to selectively include only those constructors that match the criteria.- Parameters:
type
- theTypeMirror
representing the type to retrieve constructors fromconstructorFilters
- optional predicates to filter the constructors; if none are provided, all constructors are included- Returns:
- a
List
ofExecutableElement
objects 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
type
isnull
, an empty list is returned.- Parameters:
type
- theTypeMirror
representing the type to retrieve constructors fromconstructorFilters
- optional predicates to filter the constructors; if none are provided, all constructors are included- Returns:
- a
List
ofExecutableElement
objects representing the filtered declared constructors; nevernull
, but may be empty if no matching constructors are found or if the input isnull
-
-