Modifier | Constructor and Description |
---|---|
protected |
GenericUtils(Elements elementUtils,
Types typeUtils,
ModelUtils modelUtils) |
Modifier and Type | Method and Description |
---|---|
Map<String,TypeMirror> |
alignNewGenericsInfo(List<? extends TypeParameterElement> typeParameters,
List<? extends TypeMirror> typeArguments,
Map<String,TypeMirror> genericsInfo)
Align new generic information for the given type parameters, type arguments and bound generics.
|
Map<String,Map<String,TypeMirror>> |
alignNewGenericsInfo(TypeElement typeElement,
List<? extends TypeMirror> typeArguments,
Map<String,TypeMirror> genericsInfo)
Takes a type element and the bound generic information and re-aligns for the new type.
|
Map<String,Map<String,TypeMirror>> |
buildGenericTypeArgumentElementInfo(Element element)
Builds type argument information for the given type.
|
Map<String,Map<String,Object>> |
buildGenericTypeArgumentInfo(Element element)
Builds type argument information for the given type.
|
protected Optional<TypeMirror> |
getFirstTypeArgument(TypeMirror type)
Return the first type argument for the given type mirror.
|
protected TypeMirror |
interfaceGenericTypeFor(TypeElement element,
Class interfaceType)
Finds the generic type for the given interface for the given class element.
|
protected TypeMirror |
interfaceGenericTypeFor(TypeElement element,
String interfaceName)
Finds the generic type for the given interface for the given class element.
|
List<? extends TypeMirror> |
interfaceGenericTypesFor(TypeElement element,
String interfaceName)
Finds the generic types for the given interface for the given class element.
|
protected Map<String,TypeMirror> |
resolveBoundGenerics(TypeElement declaringType,
TypeMirror returnType,
Map<String,Map<String,TypeMirror>> genericsInfo)
Resolve the bound generics.
|
protected Map<String,Object> |
resolveBoundTypes(DeclaredType type)
Resolve bound types for the given declared type.
|
protected Map<String,Object> |
resolveGenericTypes(DeclaredType type,
TypeElement typeElement,
Map<String,Object> boundTypes)
Resolve the generic type arguments for the given type mirror and bound type arguments.
|
protected Map<String,Object> |
resolveGenericTypes(TypeMirror type,
Map<String,Object> boundTypes)
Resolve the generic type arguments for the given type mirror and bound type arguments.
|
protected Object |
resolveTypeReference(TypeMirror mirror) |
protected Object |
resolveTypeReference(TypeMirror mirror,
Map<String,Object> boundTypes)
Resolve a type reference to use for the given type mirror taking into account generic type variables.
|
protected DeclaredType |
resolveTypeVariable(Element element,
TypeVariable typeVariable)
Resolve the first type argument to a parameterized type.
|
protected GenericUtils(Elements elementUtils, Types typeUtils, ModelUtils modelUtils)
elementUtils
- The Elements
typeUtils
- The Types
modelUtils
- The ModelUtils
public Map<String,Map<String,Object>> buildGenericTypeArgumentInfo(@Nonnull Element element)
element
- The elementpublic Map<String,Map<String,TypeMirror>> buildGenericTypeArgumentElementInfo(@Nonnull Element element)
element
- The elementprotected TypeMirror interfaceGenericTypeFor(TypeElement element, Class interfaceType)
For example, for class AProvider implements Provider
element = AProvider
interfaceType = interface javax.inject.Provider.class
return A
element
- The class elementinterfaceType
- The interfaceprotected TypeMirror interfaceGenericTypeFor(TypeElement element, String interfaceName)
For example, for class AProvider implements Provider<A>
element = AProvider
interfaceName = interface javax.inject.Provider
return A
element
- The class elementinterfaceName
- The interfacepublic List<? extends TypeMirror> interfaceGenericTypesFor(TypeElement element, String interfaceName)
element
- The class elementinterfaceName
- The interfaceprotected Optional<TypeMirror> getFirstTypeArgument(TypeMirror type)
String
.type
- The typeprotected Map<String,Object> resolveGenericTypes(TypeMirror type, Map<String,Object> boundTypes)
type
- The type mirrorboundTypes
- The bound types (such as those declared on the class)protected Map<String,Object> resolveGenericTypes(DeclaredType type, TypeElement typeElement, Map<String,Object> boundTypes)
type
- The declaring typetypeElement
- The type elementboundTypes
- The bound typesprotected Object resolveTypeReference(TypeMirror mirror)
mirror
- The TypeMirror
protected Object resolveTypeReference(TypeMirror mirror, Map<String,Object> boundTypes)
mirror
- The mirrorboundTypes
- The already bound types for any type variableprotected DeclaredType resolveTypeVariable(Element element, TypeVariable typeVariable)
element
- The type elementtypeVariable
- The type variableprotected Map<String,Object> resolveBoundTypes(DeclaredType type)
type
- The declaring typeprotected Map<String,TypeMirror> resolveBoundGenerics(TypeElement declaringType, TypeMirror returnType, Map<String,Map<String,TypeMirror>> genericsInfo)
declaringType
- The declaring typereturnType
- The return typegenericsInfo
- The generics information.public Map<String,Map<String,TypeMirror>> alignNewGenericsInfo(TypeElement typeElement, List<? extends TypeMirror> typeArguments, Map<String,TypeMirror> genericsInfo)
typeElement
- The type elementtypeArguments
- The type argumentsgenericsInfo
- The generic infopublic Map<String,TypeMirror> alignNewGenericsInfo(List<? extends TypeParameterElement> typeParameters, List<? extends TypeMirror> typeArguments, Map<String,TypeMirror> genericsInfo)
typeParameters
- The type parameterstypeArguments
- The type argumentsgenericsInfo
- The new generics info