java.lang.Object
org.microbean.lang.Lang
A utility class for working with the
javax.lang.model.*
packages at runtime.- Author:
- Laird Nelson
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
ATypeAndElementSource
implementation that is alsoConstable
. -
Method Summary
Modifier and TypeMethodDescriptionstatic final Set
<? extends ModuleElement> static final ArrayType
static final ArrayType
static final ArrayType
arrayTypeOf
(TypeMirror componentType) static final boolean
assignable
(TypeMirror payload, TypeMirror receiver) Returnstrue
if and only if a bearer of the suppliedpayload
is assignable to a bearer of the suppliedreceiver
.static final Name
static final TypeMirror
box
(TypeMirror t) static final TypeElement
static final boolean
static final boolean
static final TypeMirror
static final boolean
static final boolean
contains
(TypeMirror t, TypeMirror s) static final DeclaredType
declaredType
(CharSequence canonicalName) static final DeclaredType
declaredType
(Class<?> c) static final DeclaredType
static final DeclaredType
declaredType
(TypeElement typeElement, TypeMirror... typeArguments) static final DeclaredType
declaredType
(DeclaredType containingType, TypeElement typeElement, TypeMirror... typeArguments) static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final Optional
<? extends ConstantDesc> static final String
static final List
<? extends TypeMirror> static final Element
static final String
static final TypeMirror
static final ExecutableElement
executableElement
(Constructor<?> c) static final ExecutableElement
static final ExecutableElement
static final ExecutableElement
executableElement
(TypeElement declaringClass, CharSequence name, List<? extends TypeMirror> parameterTypes) static final ExecutableElement
executableElement
(TypeElement declaringClass, CharSequence name, TypeMirror... parameterTypes) static final ExecutableElement
executableElement
(TypeElement declaringClass, List<? extends TypeMirror> parameterTypes) static final ExecutableElement
executableElement
(TypeElement declaringClass, TypeMirror... parameterTypes) static final ExecutableType
static final boolean
static final boolean
static final void
Asynchronously and idempotently initializes theLang
class for use.static final String
static final TypeMirror
memberOf
(DeclaredType t, Element e) modifiers
(long modifiers) static final long
static final long
static final ModuleElement
moduleElement
(CharSequence moduleName) static final ModuleElement
moduleElement
(Class<?> c) static final ModuleElement
moduleElement
(Module module) static final ModuleElement
static final Name
name
(CharSequence name) static final NoType
static final NullType
nullType()
static final Elements.Origin
static final PackageElement
packageElement
(CharSequence fullyQualifiedName) static final PackageElement
packageElement
(Class<?> c) static final PackageElement
packageElement
(Module module, Package pkg) static final PackageElement
packageElement
(Package pkg) static final PackageElement
packageElement
(ModuleElement moduleElement, CharSequence fullyQualifiedName) static final PackageElement
packageElement
(ModuleElement moduleElement, Package pkg) static final PackageElement
static final Parameterizable
static final PrimitiveType
primitiveType
(Class<?> c) static final PrimitiveType
static final boolean
sameType
(TypeMirror t, TypeMirror s) static final boolean
static final boolean
subtype
(TypeMirror payload, TypeMirror receiver) static final TypeMirror
static final TypeMirror
static final TypeAndElementSource
Returns aTypeAndElementSource
backed by relevantstatic
methods in this class.static final List
<? extends TypeMirror> static final TypeElement
typeElement
(CharSequence canonicalName) static final TypeElement
typeElement
(Class<?> c) static final TypeElement
typeElement
(ModuleElement moduleElement, CharSequence canonicalName) static final TypeParameterElement
typeParameterElement
(GenericDeclaration gd, String name) static final TypeParameterElement
static final String
static final TypeVariable
typeVariable
(GenericDeclaration gd, String name) static final TypeVariable
typeVariable
(TypeVariable<?> t) static final TypeMirror
unbox
(TypeMirror t) static final PrimitiveType
static final <E extends Element>
Eunwrap
(E e) static final TypeMirror[]
unwrap
(TypeMirror[] ts) static final <T extends TypeMirror>
Tunwrap
(T t) static final VariableElement
static final VariableElement
variableElement
(ExecutableElement declaringExecutable, int position) static final VariableElement
variableElement
(ExecutableElement declaringExecutable, CharSequence parameterName) static final VariableElement
variableElement
(TypeElement declaringClass, CharSequence fieldName) static final WildcardType
static final WildcardType
static final WildcardType
wildcardType
(TypeMirror extendsBound, TypeMirror superBound) static final <E extends Element>
Ewrap
(E e) static final <T extends TypeMirror>
Twrap
(T t) wrapElements
(Collection<? extends Element> es) static final List
<? extends TypeMirror> wrapTypes
(Collection<? extends TypeMirror> ts)
-
Method Details
-
describeConstable
-
describeConstable
-
describeConstable
-
describeConstable
-
describeConstable
-
describeConstable
-
describeConstable
-
describeConstable
-
describeConstable
-
describeConstable
-
describeConstable
-
describeConstable
-
describeConstable
-
describeConstable
-
describeConstable
-
allModuleElements
-
binaryName
-
functionalInterface
-
generic
-
capture
-
contains
-
element
-
memberOf
-
box
-
unbox
-
boxedClass
-
bridge
-
compactConstructor
-
canonicalConstructor
-
unboxedType
-
elementSignature
-
typeSignature
-
descriptor
-
jvmBinaryName
-
directSupertypes
-
subsignature
-
erasure
-
typeAndElementSource
Returns aTypeAndElementSource
backed by relevantstatic
methods in this class.- Returns:
- a
TypeAndElementSource
; nevernull
- See Also:
-
modifiers
-
modifiers
-
modifiers
-
moduleElement
-
moduleElement
-
moduleElement
-
moduleOf
-
name
-
origin
-
packageElement
-
packageElement
-
packageElement
-
packageElement
-
packageElement
-
packageElement
public static final PackageElement packageElement(ModuleElement moduleElement, CharSequence fullyQualifiedName) -
packageOf
-
arrayType
-
arrayType
-
arrayTypeOf
-
declaredType
-
declaredType
-
declaredType
-
declaredType
-
declaredType
public static final DeclaredType declaredType(DeclaredType containingType, TypeElement typeElement, TypeMirror... typeArguments) -
typeArguments
-
executableElement
-
executableElement
-
executableElement
-
executableElement
public static final ExecutableElement executableElement(TypeElement declaringClass, List<? extends TypeMirror> parameterTypes) -
executableElement
public static final ExecutableElement executableElement(TypeElement declaringClass, TypeMirror... parameterTypes) -
executableElement
public static final ExecutableElement executableElement(TypeElement declaringClass, CharSequence name, List<? extends TypeMirror> parameterTypes) -
executableElement
public static final ExecutableElement executableElement(TypeElement declaringClass, CharSequence name, TypeMirror... parameterTypes) -
executableType
-
noType
-
nullType
-
primitiveType
-
primitiveType
-
sameType
-
typeElement
-
typeElement
-
typeElement
public static final TypeElement typeElement(ModuleElement moduleElement, CharSequence canonicalName) -
parameterizable
-
typeParameterElement
-
typeParameterElement
-
typeVariable
-
typeVariable
-
variableElement
-
variableElement
public static final VariableElement variableElement(TypeElement declaringClass, CharSequence fieldName) -
variableElement
public static final VariableElement variableElement(ExecutableElement declaringExecutable, CharSequence parameterName) -
variableElement
public static final VariableElement variableElement(ExecutableElement declaringExecutable, int position) -
wildcardType
-
wildcardType
-
wildcardType
-
assignable
Returnstrue
if and only if a bearer of the suppliedpayload
is assignable to a bearer of the suppliedreceiver
.- Parameters:
payload
- a type borne by the "right hand side" of a potential assignment; must not benull
receiver
- a type borne by the "left hand side" of a potential assignment; must not benull
- Returns:
true
if and only if a bearer of the suppliedpayload
is assignable to a bearer of the suppliedreceiver
- Throws:
NullPointerException
- if any argument isnull
- See Also:
-
subtype
-
type
-
type
-
initialize
public static final void initialize()Asynchronously and idempotently initializes theLang
class for use.This method is automatically called by the internals of this class when appropriate, but is
public
to support eager initialization use cases. -
unwrap
-
unwrap
-
unwrap
-
wrap
-
wrap
-
wrapTypes
-
wrapElements
-