Class MoreTypes
- java.lang.Object
-
- dagger.hilt.android.processor.internal.MoreTypes
-
public final class MoreTypes extends java.lang.ObjectMore utility methods for types.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.lang.model.type.ExecutableTypeasExecutable(javax.lang.model.type.TypeMirror maybeExecutableType)Returns aExecutableTypeif theTypeMirrorrepresents an executable type such as a method, constructor, or initializer or throws anIllegalArgumentException.static javax.lang.model.element.TypeElementasTypeElement(javax.lang.model.type.DeclaredType type)Returns the TypeElement corresponding to a DeclaredType.static javax.lang.model.element.TypeElementasTypeElement(javax.lang.model.type.TypeMirror type)Returns the TypeElement corresponding to a TypeMirror.static java.util.Optional<javax.lang.model.element.ExecutableElement>findInheritedMethod(javax.lang.model.util.Types types, javax.lang.model.element.TypeElement classElement, javax.lang.model.element.ExecutableElement method)Returns the first matching method, if one exists (starting with classElement, then searching each sub classes).static java.util.Optional<javax.lang.model.element.ExecutableElement>findMethod(javax.lang.model.util.Types types, javax.lang.model.element.TypeElement classElement, javax.lang.model.element.ExecutableElement method)Returns a method with a matching signature in classElement if one exists.static java.util.Set<javax.lang.model.element.ExecutableElement>findMethods(javax.lang.model.element.TypeElement classElement, java.lang.String name)Returns methods with a matching name in classElement.static javax.lang.model.type.DeclaredTypegetDeclaredType(javax.lang.model.type.TypeMirror type)If the received mirror represents a declared type or an array of declared types, this returns the represented declared type.
-
-
-
Method Detail
-
getDeclaredType
public static javax.lang.model.type.DeclaredType getDeclaredType(javax.lang.model.type.TypeMirror type)
If the received mirror represents a declared type or an array of declared types, this returns the represented declared type. Otherwise throws an IllegalStateException.
-
asTypeElement
public static javax.lang.model.element.TypeElement asTypeElement(javax.lang.model.type.TypeMirror type)
Returns the TypeElement corresponding to a TypeMirror.
-
asTypeElement
public static javax.lang.model.element.TypeElement asTypeElement(javax.lang.model.type.DeclaredType type)
Returns the TypeElement corresponding to a DeclaredType.
-
asExecutable
public static javax.lang.model.type.ExecutableType asExecutable(javax.lang.model.type.TypeMirror maybeExecutableType)
Returns aExecutableTypeif theTypeMirrorrepresents an executable type such as a method, constructor, or initializer or throws anIllegalArgumentException.
-
findInheritedMethod
public static java.util.Optional<javax.lang.model.element.ExecutableElement> findInheritedMethod(javax.lang.model.util.Types types, javax.lang.model.element.TypeElement classElement, javax.lang.model.element.ExecutableElement method)Returns the first matching method, if one exists (starting with classElement, then searching each sub classes).
-
findMethod
public static java.util.Optional<javax.lang.model.element.ExecutableElement> findMethod(javax.lang.model.util.Types types, javax.lang.model.element.TypeElement classElement, javax.lang.model.element.ExecutableElement method)Returns a method with a matching signature in classElement if one exists.
-
findMethods
public static java.util.Set<javax.lang.model.element.ExecutableElement> findMethods(javax.lang.model.element.TypeElement classElement, java.lang.String name)Returns methods with a matching name in classElement.
-
-