Package com.squareup.kotlinpoet.metadata.specs

Types

ClassData
Link copied to clipboard

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

data class ClassData(declarationContainer: ImmutableKmClass, className: ClassName, annotations: Collection<AnnotationSpec>, properties: Map<ImmutableKmProperty, PropertyData>, constructors: Map<ImmutableKmConstructor, ConstructorData>, methods: Map<ImmutableKmFunction, MethodData>) : ContainerData
ClassInspector
Link copied to clipboard

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

interface ClassInspector
ConstructorData
Link copied to clipboard

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

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

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).

interface ContainerData
EnumEntryData
Link copied to clipboard

Represents relevant information on a Kotlin enum entry.

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

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

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

Represents relevant information on a file facade used for ClassInspector.

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

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

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

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

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

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.

This API is considered read-only and should not be implemented outside of KotlinPoet.

interface JvmModifier
MethodData
Link copied to clipboard

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

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

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

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

This tag indicates that this TypeName represents a typealias type.

class TypeNameAliasTag(type: TypeName)

Functions

classFor
Link copied to clipboard

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.

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

Creates a new ContainerData instance for a given className.

fun ClassInspector.containerData(className: ClassName, parentClassName: ClassName?): ContainerData
toFileSpec
Link copied to clipboard
fun Class<*>.toFileSpec(classInspector: ClassInspector?): FileSpec
fun TypeElement.toFileSpec(classInspector: ClassInspector?): FileSpec
fun KClass<*>.toFileSpec(classInspector: ClassInspector?): FileSpec
fun ImmutableKmClass.toFileSpec(classInspector: ClassInspector?, className: ClassName): FileSpec
fun ImmutableKmPackage.toFileSpec(classInspector: ClassInspector?, className: ClassName): FileSpec
toTypeSpec
Link copied to clipboard
fun Class<*>.toTypeSpec(classInspector: ClassInspector?): TypeSpec
fun TypeElement.toTypeSpec(classInspector: ClassInspector?): TypeSpec
fun KClass<*>.toTypeSpec(classInspector: ClassInspector?): TypeSpec
fun ImmutableKmClass.toTypeSpec(classInspector: ClassInspector?, className: ClassName): TypeSpec