-
public final class UtilsKt
-
-
Field Summary
Fields Modifier and Type Field Description private final static KSFilecontainingFilepublic final static StringExceptionMessageprivate final static KSTypeouterTypeprivate final static List<KSTypeArgument>innerArguments
-
Method Summary
Modifier and Type Method Description final KSFilegetContainingFile()final KSTypegetOuterType()final List<KSTypeArgument>getInnerArguments()final static <T extends Any> KSClassDeclarationgetClassDeclarationByName(Resolver $self)Try to resolve the KSClassDeclaration for a class using its fully qualified name. final static KSClassDeclarationgetClassDeclarationByName(Resolver $self, String name)Find a class in the compilation classpath for the given name. final static Sequence<KSFunctionDeclaration>getFunctionDeclarationsByName(Resolver $self, String name, Boolean includeTopLevel)Find functions in the compilation classpath for the given name. final static KSPropertyDeclarationgetPropertyDeclarationByName(Resolver $self, String name, Boolean includeTopLevel)Find a property in the compilation classpath for the given name. final static Sequence<KSFunctionDeclaration>getDeclaredFunctions(KSClassDeclaration $self)Get functions directly declared inside the class declaration. final static Sequence<KSPropertyDeclaration>getDeclaredProperties(KSClassDeclaration $self)Get properties directly declared inside the class declaration. final static Sequence<KSFunctionDeclaration>getConstructors(KSClassDeclaration $self)final static BooleanisLocal(KSDeclaration $self)Check whether this is a local declaration, or namely, declared in a function. final static Booleanvalidate(KSNode $self, Function2<KSNode, KSNode, Boolean> predicate)Perform a validation on a given symbol to check if all interested types in symbols enclosed scope are valid, i.e. final static KSClassDeclarationfindActualType(KSTypeAlias $self)Find the KSClassDeclaration that the alias points to recursively. final static VisibilitygetVisibility(KSDeclaration $self)Determine Visibility of a KSDeclaration. final static Sequence<KSType>getAllSuperTypes(KSClassDeclaration $self)get all super types for a class declaration Calling getAllSuperTypes requires type resolution therefore is expensive and should be avoided if possible. final static BooleanisAbstract(KSClassDeclaration $self)final static BooleanisAbstract(KSPropertyDeclaration $self)final static BooleanisOpen(KSDeclaration $self)final static BooleanisPublic(KSDeclaration $self)final static BooleanisProtected(KSDeclaration $self)final static BooleanisInternal(KSDeclaration $self)final static BooleanisPrivate(KSDeclaration $self)final static BooleanisJavaPackagePrivate(KSDeclaration $self)final static KSClassDeclarationclosestClassDeclaration(KSDeclaration $self)final static BooleanisVisibleFrom(KSDeclaration $self, KSDeclaration other)final static BooleanisConstructor(KSFunctionDeclaration $self)Returns trueif this is a constructor function.final static KSClassDeclarationgetKotlinClassByName(Resolver $self, KSName name)final static KSClassDeclarationgetKotlinClassByName(Resolver $self, String name)final static KSClassDeclarationgetJavaClassByName(Resolver $self, KSName name)final static KSClassDeclarationgetJavaClassByName(Resolver $self, String name)final static <T extends Annotation> Sequence<T>getAnnotationsByType(KSAnnotated $self, KClass<T> annotationKClass)final static <T extends Annotation> BooleanisAnnotationPresent(KSAnnotated $self, KClass<T> annotationKClass)final static BooleanisDefault(KSValueArgument $self)-
-
Method Detail
-
getContainingFile
final KSFile getContainingFile()
-
getOuterType
final KSType getOuterType()
-
getInnerArguments
final List<KSTypeArgument> getInnerArguments()
-
getClassDeclarationByName
final static <T extends Any> KSClassDeclaration getClassDeclarationByName(Resolver $self)
Try to resolve the KSClassDeclaration for a class using its fully qualified name.
-
getClassDeclarationByName
final static KSClassDeclaration getClassDeclarationByName(Resolver $self, String name)
Find a class in the compilation classpath for the given name.
- Parameters:
name- fully qualified name of the class to be loaded; using '.' as separator.
-
getFunctionDeclarationsByName
final static Sequence<KSFunctionDeclaration> getFunctionDeclarationsByName(Resolver $self, String name, Boolean includeTopLevel)
Find functions in the compilation classpath for the given name.
- Parameters:
name- fully qualified name of the function to be loaded; using '.' as separator.includeTopLevel- a boolean value indicate if top level functions should be searched.
-
getPropertyDeclarationByName
final static KSPropertyDeclaration getPropertyDeclarationByName(Resolver $self, String name, Boolean includeTopLevel)
Find a property in the compilation classpath for the given name.
- Parameters:
name- fully qualified name of the property to be loaded; using '.' as separator.includeTopLevel- a boolean value indicate if top level properties should be searched.
-
getDeclaredFunctions
final static Sequence<KSFunctionDeclaration> getDeclaredFunctions(KSClassDeclaration $self)
Get functions directly declared inside the class declaration.
What are included: member functions, constructors, extension functions declared inside it, etc. What are NOT included: inherited functions, extension functions declared outside it.
-
getDeclaredProperties
final static Sequence<KSPropertyDeclaration> getDeclaredProperties(KSClassDeclaration $self)
Get properties directly declared inside the class declaration.
What are included: member properties, extension properties declared inside it, etc. What are NOT included: inherited properties, extension properties declared outside it.
-
getConstructors
final static Sequence<KSFunctionDeclaration> getConstructors(KSClassDeclaration $self)
-
isLocal
final static Boolean isLocal(KSDeclaration $self)
Check whether this is a local declaration, or namely, declared in a function.
-
validate
final static Boolean validate(KSNode $self, Function2<KSNode, KSNode, Boolean> predicate)
Perform a validation on a given symbol to check if all interested types in symbols enclosed scope are valid, i.e. resolvable.
- Parameters:
predicate- : A lambda for filtering interested symbols for performance purpose.
-
findActualType
final static KSClassDeclaration findActualType(KSTypeAlias $self)
Find the KSClassDeclaration that the alias points to recursively.
-
getVisibility
final static Visibility getVisibility(KSDeclaration $self)
Determine Visibility of a KSDeclaration.
-
getAllSuperTypes
final static Sequence<KSType> getAllSuperTypes(KSClassDeclaration $self)
get all super types for a class declaration Calling getAllSuperTypes requires type resolution therefore is expensive and should be avoided if possible.
-
isAbstract
final static Boolean isAbstract(KSClassDeclaration $self)
-
isAbstract
final static Boolean isAbstract(KSPropertyDeclaration $self)
-
isOpen
final static Boolean isOpen(KSDeclaration $self)
-
isPublic
final static Boolean isPublic(KSDeclaration $self)
-
isProtected
final static Boolean isProtected(KSDeclaration $self)
-
isInternal
final static Boolean isInternal(KSDeclaration $self)
-
isPrivate
final static Boolean isPrivate(KSDeclaration $self)
-
isJavaPackagePrivate
final static Boolean isJavaPackagePrivate(KSDeclaration $self)
-
closestClassDeclaration
final static KSClassDeclaration closestClassDeclaration(KSDeclaration $self)
-
isVisibleFrom
final static Boolean isVisibleFrom(KSDeclaration $self, KSDeclaration other)
-
isConstructor
final static Boolean isConstructor(KSFunctionDeclaration $self)
Returns
trueif this is a constructor function.
-
getKotlinClassByName
final static KSClassDeclaration getKotlinClassByName(Resolver $self, KSName name)
-
getKotlinClassByName
final static KSClassDeclaration getKotlinClassByName(Resolver $self, String name)
-
getJavaClassByName
final static KSClassDeclaration getJavaClassByName(Resolver $self, KSName name)
-
getJavaClassByName
final static KSClassDeclaration getJavaClassByName(Resolver $self, String name)
-
getAnnotationsByType
final static <T extends Annotation> Sequence<T> getAnnotationsByType(KSAnnotated $self, KClass<T> annotationKClass)
-
isAnnotationPresent
final static <T extends Annotation> Boolean isAnnotationPresent(KSAnnotated $self, KClass<T> annotationKClass)
-
isDefault
final static Boolean isDefault(KSValueArgument $self)
-
-
-
-