Skip to content

Releases: mabd-dev/KMeta

v0.1.0 - Initial Release

09 Nov 05:48
086129e

Choose a tag to compare

KMeta v0.1.0 - Initial Release

Overview

KMeta is a Kotlin Metaprogramming & Code Generation Toolkit that leverages KSP (Kotlin Symbol Processing) to automate common boilerplate code
generation patterns. This initial release provides three powerful annotations for interface decoration and data class mimicking.

Features

  1. @loggable - Automatic Interface Decorator Generation
    Automatically generates decorator implementations for interfaces with built-in logging capabilities.
    Use Case: Add logging to any interface without modifying existing implementations.
  @Loggable
  interface ApiService {
      fun fetchUserNames(): List<String>
  }
  // Generated: ApiServiceLoggerImpl that logs all method calls

Capabilities:

  • Supports interfaces with generics
  • Handles both public and private interfaces
  • Generates clean, readable decorator code
  1. @copy - Copy Function for Regular Classes
    Adds a copy() extension function to non-data classes, mimicking data class behavior.
    Use Case: Add immutability patterns to regular classes without converting them to data classes.
  @Copy
  class Person(val name: String, val age: Int)
  // Usage: val updated = person.copy(age = 31)
  1. @ToNiceString - String Representation for Regular Classes
    Generates a toNiceString() extension function for non-data classes.
    Use Case: Add readable string representations without overriding toString().
@ToNiceString
class Person(val name: String, val age: Int)

// Usage: println(person.toNiceString())
// Output: Person(name=John, age=30)