Package com.squareup.kotlinpoet.metadata.specs

Types

ClassData
Link copied to clipboard
data class ClassData(declarationContainer: KmClass, className: ClassName, annotations: Collection<AnnotationSpec>, properties: Map<KmProperty, PropertyData>, constructors: Map<KmConstructor, ConstructorData>, methods: Map<KmFunction, MethodData>) : ContainerData

Represents relevant information on a Kotlin class used for ClassInspector. Can only ever be applied on a class and not file facades.

ClassInspector
Link copied to clipboard
interface ClassInspector

A basic interface for looking up JVM information about a given Class.

ConstructorData
Link copied to clipboard
data class ConstructorData(annotations: List<AnnotationSpec>, parameterAnnotations: Map<Int, Collection<AnnotationSpec>>, isSynthetic: Boolean, jvmModifiers: Set<JvmMethodModifier>, exceptions: List<TypeName>)

Represents relevant information on a constructor used for ClassInspector. Should only be associated with constructors of a ClassData.

ContainerData
Link copied to clipboard
interface ContainerData

Represents relevant information on a declaration container used for ClassInspector. Can only ever be applied on a Kotlin type (i.e. is annotated with Metadata).

EnumEntryData
Link copied to clipboard
data class EnumEntryData(declarationContainer: KmClass?, annotations: Collection<AnnotationSpec>)

Represents relevant information on a Kotlin enum entry.

FieldData
Link copied to clipboard
data class FieldData(annotations: List<AnnotationSpec>, isSynthetic: Boolean, jvmModifiers: Set<JvmFieldModifier>, constant: CodeBlock?)

Represents relevant information on a field used for ClassInspector. Should only be associated with a PropertyData.

FileData
Link copied to clipboard
data class FileData(declarationContainer: KmPackage, annotations: Collection<AnnotationSpec>, properties: Map<KmProperty, PropertyData>, methods: Map<KmFunction, MethodData>, className: ClassName, jvmName: String?) : ContainerData

Represents relevant information on a file facade used for ClassInspector.

JvmFieldModifier
Link copied to clipboard
enum JvmFieldModifier : Enum<JvmFieldModifier> , JvmModifier

Modifiers that are annotations in Kotlin but modifier keywords in bytecode.

JvmMethodModifier
Link copied to clipboard
enum JvmMethodModifier : Enum<JvmMethodModifier> , JvmModifier

Modifiers that are annotations or implicit in Kotlin but modifier keywords in bytecode.

JvmModifier
Link copied to clipboard
interface JvmModifier

Represents a JVM modifier that is represented as an annotation in Kotlin but as a modifier in bytecode. Examples include annotations such as @JvmStatic or @JvmSynthetic.

MethodData
Link copied to clipboard
data class MethodData(annotations: List<AnnotationSpec>, parameterAnnotations: Map<Int, Collection<AnnotationSpec>>, isSynthetic: Boolean, jvmModifiers: Set<JvmMethodModifier>, isOverride: Boolean, exceptions: List<TypeName>)

Represents relevant information on a method used for ClassInspector. Should only be associated with methods of a ClassData or PropertyData.

PropertyData
Link copied to clipboard
data class PropertyData(annotations: List<AnnotationSpec>, fieldData: FieldData?, getterData: MethodData?, setterData: MethodData?, isJvmField: Boolean)

Represents relevant information on a property used for ClassInspector. Should only be associated with properties of a ClassData.

Functions

classFor
Link copied to clipboard
fun ClassInspector.classFor(className: ClassName): KmClass

Looks up other classes, such as for nested members. Note that this class would always be Kotlin, so Metadata can be relied on for this.

containerData
Link copied to clipboard
fun ClassInspector.containerData(className: ClassName, parentClassName: ClassName?): ContainerData

Creates a new ContainerData instance for a given className.

toFileSpec
Link copied to clipboard
fun Class<*>.toFileSpec(classInspector: ClassInspector? = null): FileSpec
fun TypeElement.toFileSpec(classInspector: ClassInspector? = null): FileSpec
fun KClass<*>.toFileSpec(classInspector: ClassInspector? = null): FileSpec
fun KmClass.toFileSpec(classInspector: ClassInspector?, className: ClassName = createClassName(name)): FileSpec
fun KmPackage.toFileSpec(classInspector: ClassInspector?, className: ClassName): FileSpec
toTypeSpec
Link copied to clipboard
fun Class<*>.toTypeSpec(classInspector: ClassInspector? = null): TypeSpec
fun TypeElement.toTypeSpec(classInspector: ClassInspector? = null): TypeSpec
fun KClass<*>.toTypeSpec(classInspector: ClassInspector? = null): TypeSpec
fun KmClass.toTypeSpec(classInspector: ClassInspector?, className: ClassName = createClassName(name)): TypeSpec

Properties

isExtensionType
Link copied to clipboard
val KmType.isExtensionType: Boolean

true if this is an extension type (i.e. String.() -> Unit vs (String) -> Unit).