KtPureClassOrObject¶
interface KtPureClassOrObject : KtPureElement, KtDeclarationContainer
A minimal interface that KtClassOrObject implements for the purpose of code-generation that does not need the full power of PSI. This interface can be easily implemented by synthetic elements to generate code for them.
Inheritors¶
Properties¶
pureEndOffset¶
The end offset of this element's source.
pureStartOffset¶
The start offset of this element's source, excluding any leading comments.
Functions¶
getBody¶
@Nullable
abstract fun getBody(): KtClassBody
Returns the body of this class or object (the part enclosed in braces), or null if it has no body.
getCompanionObjects¶
@NotNull
@ReadOnly
abstract fun getCompanionObjects(): List<KtObjectDeclaration>
Returns the companion objects declared in this class or object body, or an empty list if there are none.
getContainingKtFile¶
@NotNull
abstract fun getContainingKtFile(): KtFile
Returns the KtFile this element belongs to.
getContextReceivers¶
@NotNull
@ReadOnly
abstract fun getContextReceivers(): List<KtContextReceiver>
Returns the unnamed context receivers declared on this class or object, or an empty list if there are none. This is the legacy context-receiver API; named context parameters are exposed by KtContextParameterList.
getDeclarations¶
@NotNull
@ReadOnly
abstract fun getDeclarations(): List<KtDeclaration>
Returns the declarations directly contained in this element, in their source order. Returns an empty list if there are none.
getName¶
Returns the simple name of this class or object, or null if it has none (for example, an object literal).
getParent¶
abstract fun getParent(): PsiElement
Returns parent source element.
getPrimaryConstructor¶
@Nullable
abstract fun getPrimaryConstructor(): KtPrimaryConstructor
Returns the primary constructor, or null if there is no explicitly written primary constructor.
getPrimaryConstructorModifierList¶
@Nullable
abstract fun getPrimaryConstructorModifierList(): KtModifierList
Returns the modifier list of the primary constructor (for example, its visibility modifiers), or null if there is no explicitly written primary constructor or it has no modifiers.
getPrimaryConstructorParameters¶
@NotNull
@ReadOnly
abstract fun getPrimaryConstructorParameters(): List<KtParameter>
Returns the value parameters of the primary constructor, or an empty list if there are none.
getPsiOrParent¶
@NotNull
abstract fun getPsiOrParent(): KtElement
Returns this or parent source element (for synthetic element declarations). Use it only for the purposes of source attribution.
getSecondaryConstructors¶
@NotNull
@ReadOnly
abstract fun getSecondaryConstructors(): List<KtSecondaryConstructor>
Returns the secondary constructors declared in this class or object body, or an empty list if there are none.
getSuperTypeListEntries¶
@NotNull
@ReadOnly
abstract fun getSuperTypeListEntries(): List<KtSuperTypeListEntry>
Returns the supertype list entries (the types and delegations written after the :), or an empty list if there are none.
hasExplicitPrimaryConstructor¶
abstract fun hasExplicitPrimaryConstructor(): Boolean
Returns true if this class or object has an explicitly written primary constructor.
hasPrimaryConstructor¶
abstract fun hasPrimaryConstructor(): Boolean
Returns true if this class or object has an explicit primary constructor or has no secondary constructors. Consequently, this can be true for an object and when getPrimaryConstructor is null.
isLocal¶
Returns true if this class or object is declared in a local scope (inside a function body or another block) rather than as a top-level or member declaration.