Amplication AST Libraries Documentation
    Preparing search index...

    Represents a C# class in the AST. This class handles the generation of C# class declarations including fields, constructors, methods, and nested types.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    name: string

    The name of the class

    namespace: string

    The namespace containing the class

    access: Access

    The access level of the class

    abstract: boolean

    Whether the class is abstract

    static_: boolean

    Whether the class is static

    sealed: boolean

    Whether the class is sealed

    partial: boolean

    Whether the class is partial

    reference: ClassReference

    The class reference for this class

    interfaceReferences: ClassReference[]

    The interfaces implemented by this class

    isNestedClass: boolean

    Whether this is a nested class

    annotations: Annotation[] = []

    The annotations applied to this class

    splitAnnotations?: boolean

    Whether to split annotations onto separate lines

    parentClassReference: undefined | ClassReference | GenericClassReference

    The parent class this class inherits from

    Methods

    • Adds a field to the class.

      Parameters

      • field: Field

        The field to add

      Returns void

    • Adds a constructor to the class.

      Parameters

      Returns void

    • Adds a method to the class.

      Parameters

      • method: Method

        The method to add

      Returns void

    • Adds a nested class to this class.

      Parameters

      • subClass: Class

        The nested class to add

      Returns void

    • Adds a nested interface to this class.

      Parameters

      • subInterface: Interface

        The nested interface to add

      Returns void

    • Writes the class declaration and its members to the writer.

      Parameters

      • writer: Writer

        The writer to write to

      Returns void

    • Gets all fields in the class.

      Returns Field[]

      All fields in the class

    • Gets all methods in the class.

      Returns Method[]

      All methods in the class

    • Returns the string representation of the AST node. This method creates a new Writer instance and writes the node's content to it.

      Returns string

      The string representation of the AST node