The Director
library is an annotation-based code generation tool that helps developers automatically generate mapping functions for their Kotlin classes.
- Annotation-based: Simply annotate your data classes and let the library do the rest.
- Automatic generation: No need to manually write mapping functions.
- Editable mapper support: Easily define which fields are editable and which are not.
- Clear and concise mapping: Generated functions are readable and easy to understand.
[Installation Instructions Placeholder - Typically this would be how to add the library to Gradle/Maven]
-
Annotate your classes
Use the
@Mapper
and@EditableMapper
annotations to specify your source and target classes.@Mapper(target = TargetClass::class) data class SourceClass(val prop1: Type1, val prop2: Type2)
-
Use Generated Mappers:
After building your project, Director will generate extension functions that you can use for mapping:
val source = SourceClass(...) val target = source.toTargetClass()
-
Editable Fields:
Use the
@EditableMapper
to specify fields that are editable:@EditableMapper(target = TargetClass::class, editableFields = ["field1", "field2"]) data class SourceClass(...)