Package io.determann.shadow.impl.shadow
Class ClassImpl
java.lang.Object
io.determann.shadow.impl.shadow.ShadowImpl<DeclaredType>
io.determann.shadow.impl.shadow.DeclaredImpl
io.determann.shadow.impl.shadow.ClassImpl
- All Implemented Interfaces:
Annotationable<TypeElement>,ApiHolder,ElementBacked<TypeElement>,MirrorBacked<DeclaredType>,AbstractModifiable,AccessModifiable,FinalModifiable,Modifiable,Sealable,StaticModifiable,StrictfpModifiable,QualifiedNameable<TypeElement>,Annotation,Class,Declared,Enum,Shadow<DeclaredType>
-
Constructor Summary
ConstructorsConstructorDescriptionClassImpl(ShadowApi shadowApi, TypeElement typeElement) ClassImpl(ShadowApi shadowApi, DeclaredType declaredTypeMirror) -
Method Summary
Modifier and TypeMethodDescriptionInteger -> int
Long -> long etc...erasure()Information regarding generics is lost after the compilation.List<T>List<String>returns the outer type for not static classesUsed when constructing types to compare to at compile time that contain multiple, on each other depended, generics.booleanisAssignableFrom(Shadow<? extends TypeMirror> shadow) Equivalent toDeclared.isSubtypeOf(Shadow)except for primitives.final ClasswithGenerics(Shadow<? extends TypeMirror>... generics) shadowApi.getDeclaredOrThrow("java.util.List")representsListshadowApi.getDeclaredOrThrow("java.util.List").withGenerics(shadowApi.getDeclaredOrThrow("java.lang.String"))representsList<String>withGenerics(String... qualifiedGenerics) likeClass.withGenerics(Shadow[])but resolves the names usingDeclaredHolder.getDeclaredOrThrow(String)Methods inherited from class io.determann.shadow.impl.shadow.DeclaredImpl
asArray, asExtendsWildcard, asSuperWildcard, equals, getBinaryName, getConstructors, getDirectInterfaceOrThrow, getDirectInterfaces, getDirectSuperTypes, getElement, getEnumConstantOrThrow, getEumConstants, getFieldOrThrow, getFields, getInterfaceOrThrow, getInterfaces, getMethods, getMethods, getNesting, getPackage, getSuperTypes, getTypeKind, hashCode, isSubtypeOf, toStringMethods inherited from class io.determann.shadow.impl.shadow.ShadowImpl
getApi, getMirror, isTypeKind, representsSameTypeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.determann.shadow.api.modifier.AbstractModifiable
isAbstractMethods inherited from interface io.determann.shadow.api.modifier.AccessModifiable
isPackagePrivate, isPrivate, isProtected, isPublicMethods inherited from interface io.determann.shadow.api.Annotationable
getAnnotationUsages, getDirectAnnotationUsages, getDirectUsageOf, getDirectUsageOfOrThrow, getDirectUsagesOf, getUsageOf, getUsageOfOrThrow, getUsagesOf, isAnnotatedWith, isDirectlyAnnotatedWithMethods inherited from interface io.determann.shadow.api.shadow.Declared
asArray, asExtendsWildcard, asSuperWildcard, getBinaryName, getConstructors, getDirectInterfaceOrThrow, getDirectInterfaces, getDirectSuperTypes, getFieldOrThrow, getFields, getInterfaceOrThrow, getInterfaces, getMethods, getMethods, getNesting, getPackage, getSuperTypes, isSubtypeOfMethods inherited from interface io.determann.shadow.api.ElementBacked
getElement, getJavaDoc, getModifiers, getModule, getSimpleName, logError, logInfo, logWarningMethods inherited from interface io.determann.shadow.api.modifier.FinalModifiable
isFinalMethods inherited from interface io.determann.shadow.api.modifier.Modifiable
hasModifierMethods inherited from interface io.determann.shadow.api.QualifiedNameable
getQualifiedNameMethods inherited from interface io.determann.shadow.api.modifier.Sealable
isNonSealed, isSealedMethods inherited from interface io.determann.shadow.api.shadow.Shadow
getApi, getMirror, getTypeKind, isTypeKind, representsSameTypeMethods inherited from interface io.determann.shadow.api.modifier.StaticModifiable
isStaticMethods inherited from interface io.determann.shadow.api.modifier.StrictfpModifiable
isStrictfp
-
Constructor Details
-
ClassImpl
-
ClassImpl
-
-
Method Details
-
isAssignableFrom
Description copied from interface:ClassEquivalent toDeclared.isSubtypeOf(Shadow)except for primitives. if one is a primitive and the other is not it tries to convert them- Specified by:
isAssignableFromin interfaceClass
-
getSuperClass
Description copied from interface:Classreruns the super class of this class. callinggetSuperClass())onIntegerwill returnNumber. ForObjectnull will be returned- Specified by:
getSuperClassin interfaceClass
-
getPermittedSubClasses
- Specified by:
getPermittedSubClassesin interfaceClass
-
getProperties
- Specified by:
getPropertiesin interfaceClass
-
getMutableProperties
- Specified by:
getMutablePropertiesin interfaceClass
-
getImmutableProperties
- Specified by:
getImmutablePropertiesin interfaceClass
-
getOuterType
Description copied from interface:Classreturns the outer type for not static classes- Specified by:
getOuterTypein interfaceClass
-
withGenerics
Description copied from interface:ClassshadowApi.getDeclaredOrThrow("java.util.List")representsListshadowApi.getDeclaredOrThrow("java.util.List").withGenerics(shadowApi.getDeclaredOrThrow("java.lang.String"))representsList<String>- Specified by:
withGenericsin interfaceClass
-
withGenerics
Description copied from interface:ClasslikeClass.withGenerics(Shadow[])but resolves the names usingDeclaredHolder.getDeclaredOrThrow(String)- Specified by:
withGenericsin interfaceClass
-
getGenerics
Description copied from interface:ClassList<String>- Specified by:
getGenericsin interfaceClass
-
getFormalGenerics
Description copied from interface:ClassList<T>- Specified by:
getFormalGenericsin interfaceClass
-
interpolateGenerics
Description copied from interface:ClassUsed when constructing types to compare to at compile time that contain multiple, on each other depended, generics.it answers the question: given
public class MyClass<A extends Comparable<B>, B extends Comparable<A>> {}and A beingStringwhat can B be by returning the "simplest" possible answer. in this case StringThe code for the example
Note the use of the unboundWildcardConstant witch gets replaced by callingClass declared = shadowApi.getClassOrThrow("io.determann.shadow.example.processed.MyClass") .withGenerics(shadowApi.getDeclaredOrThrow("java.lang.String"), shadowApi.getConstants().getUnboundWildcard()); Class capture = declared.interpolateGenerics(); Shadow<TypeMirror> stringRep = convert(capture.getGenerics().get(1)) .toGeneric() .map(Generic::getExtends) .map(shadowApi::convert) .flatMap(ShadowConverter::toClassOrThrow) .map(Class::getGenerics) .map(shadows -> shadows.get(0)) .orElseThrow(); System.out.println(stringRep.representsSameType(shadowApi.getDeclaredOrThrow("java.lang.String")));capture()with the result- Specified by:
interpolateGenericsin interfaceClass
-
erasure
Description copied from interface:ClassInformation regarding generics is lost after the compilation. For ExampleList<String>becomesList. This method Does the same. This can be useful if you want to check if a shadow implements for exampleCollectionshadowToTest.erasure().isSubtypeOf(shadowApi.getDeclaredOrThrow("java.util.Collection").erasure())for
Classs this means for exampleclass MyClass<T>{}->class MyClass{} -
asUnboxed
Description copied from interface:ClassInteger -> int
Long -> long etc...
-