Implier
Kotlin Symbol Processor library for creating Mutable, Immutable, Builders, DSL Builders from interfaces & abstract classes with properties.
Install / Use
/learn @y9vad9/ImplierREADME
implier
Kotlin Symbol Processor library for creating Mutable , Immutable , Builders , DSL Builders from interfaces & abstract classes with properties.
Examples
Immutable & Mutable
@ImmutableImpl
@MutableImpl
interface Sample {
val sample: String
}
Will generate next classes and functions:
fun Sample.toImmutable(): ImmutableSample = ImmutableSample(sample)
class ImmutableSample(
override val sample: String
) : Sample
fun Sample.toMutable(): MutableSample = MutableSample(sample)
class MutableSample(
override var sample: String
) : Sample
Builders
// required for annotations above. They can be used with either ImmutableImpl or MutableImpl
@ImmutableImpl(visibility = Visibility.INTERNAL)
@DSLBuilderImpl(functionName = "foo")
@BuilderImpl
@FactoryFunctionImpl
interface Foo {
val bar: Bar
}
Will generate:
// generated file: FooFactory
fun Foo(bar: Bar): Foo = ImmutableFoo(bar)
// generatedfile: FooBuilder
class FooBuilder {
fun bar(bar: Bar): FooBuilder { /* code */ }
fun build(): Foo { /* code */ }
}
// generated file: FooBuilderScope
class FooDSLBuilderScope {
var bar: Bar by Delegates.notNull()
}
fun foo(builder: FooDSLBuilderScope.() -> Unit): Foo { /* code */ }
Implementation
For first, we need to add repository:
repositories {
maven("https://maven.y9vad9.com")
}
And then we need to add dependency:
dependencies {
implementation("com.y9vad9.implier:implier:$version") // annotations
ksp("com.y9vad9.implier:ksp:$version") // ksp implementation of annotations
}
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
