Interface KSClassDeclaration

  • All Implemented Interfaces:
    com.google.devtools.ksp.symbol.KSAnnotated , com.google.devtools.ksp.symbol.KSDeclaration , com.google.devtools.ksp.symbol.KSDeclarationContainer , com.google.devtools.ksp.symbol.KSExpectActual , com.google.devtools.ksp.symbol.KSModifierListOwner , com.google.devtools.ksp.symbol.KSNode

    
    public interface KSClassDeclaration
     implements KSDeclaration, KSDeclarationContainer
                        

    Models class-like declarations, including class, interface and object.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Sequence<KSClassDeclaration> getSealedSubclasses()
      abstract Sequence<KSFunctionDeclaration> getAllFunctions() Get all member functions of a class declaration, including declared and inherited.
      abstract Sequence<KSPropertyDeclaration> getAllProperties() Get all member properties of a class declaration, including declared and inherited.
      abstract KSType asType(List<KSTypeArgument> typeArguments) Create a type by applying a list of type arguments to this class' type parameters.
      abstract KSType asStarProjectedType() If this is a generic class, return the type where the type argument is applied with star projection at use-site.
      abstract ClassKind getClassKind() The Kind of the class declaration.
      abstract KSFunctionDeclaration getPrimaryConstructor() Primary constructor of a class, secondary constructors can be obtained by filtering declarations.
      abstract Sequence<KSTypeReference> getSuperTypes() Sequence of supertypes of this class, containing both super class and implemented interfaces.
      abstract Boolean isCompanionObject() Determine whether this class declaration is a companion object.
      • Methods inherited from class com.google.devtools.ksp.symbol.KSNode

        accept, getLocation, getOrigin, getParent
      • Methods inherited from class com.google.devtools.ksp.symbol.KSExpectActual

        findActuals, findExpects, isActual, isExpect
      • Methods inherited from class com.google.devtools.ksp.symbol.KSDeclaration

        getContainingFile, getDocString, getPackageName, getParentDeclaration, getQualifiedName, getSimpleName, getTypeParameters
      • Methods inherited from class com.google.devtools.ksp.symbol.KSModifierListOwner

        getModifiers
      • Methods inherited from class com.google.devtools.ksp.symbol.KSAnnotated

        getAnnotations
      • Methods inherited from class com.google.devtools.ksp.symbol.KSDeclarationContainer

        getDeclarations
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • getAllFunctions

         abstract Sequence<KSFunctionDeclaration> getAllFunctions()

        Get all member functions of a class declaration, including declared and inherited.

        Returns:

        Sequence of function declarations from the class members. Calling getAllFunctions requires type resolution which is expensive and should be avoided if possible.

      • getAllProperties

         abstract Sequence<KSPropertyDeclaration> getAllProperties()

        Get all member properties of a class declaration, including declared and inherited.

        Returns:

        Sequence of properties declarations from the class members. Calling getAllProperties requires type resolution which is expensive and should be avoided if possible.

      • asType

         abstract KSType asType(List<KSTypeArgument> typeArguments)

        Create a type by applying a list of type arguments to this class' type parameters.

        Parameters:
        typeArguments - List of Type arguments to be applied.
        Returns:

        A type constructed from this class declaration with type parameters substituted with the type arguments.

      • asStarProjectedType

         abstract KSType asStarProjectedType()

        If this is a generic class, return the type where the type argument is applied with star projection at use-site.

        Returns:

        A type with all type parameters applied with star projection.

      • isCompanionObject

         abstract Boolean isCompanionObject()

        Determine whether this class declaration is a companion object.