Skip to content

Commit

Permalink
cleaning code
Browse files Browse the repository at this point in the history
  • Loading branch information
kl3jvi committed Aug 23, 2022
1 parent 582f69b commit 141b8da
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AnnotationProcessor : AbstractProcessor() {
return roundEnv.processForAnnotation<MapToDomain, MapToEntity> { element, annotation ->
when (annotation) {
MapToEntity::class.java -> element.processEntityAnnotation()
MapToDomain::class.java -> element.processUiAnnotation()
MapToDomain::class.java -> element.processDomainAnnotation()
}
}
}
Expand All @@ -49,7 +49,7 @@ class AnnotationProcessor : AbstractProcessor() {
* It takes the annotation fields and generates a function that returns a new instance of the target class with the
* fields that are not in the filter list set to the values of the fields in the annotated class
*/
private fun Element.processUiAnnotation() {
private fun Element.processDomainAnnotation() {
val className = simpleName.toString()
val pack = processingEnv.elementUtils.getPackageOf(this).toString()

Expand Down Expand Up @@ -84,7 +84,8 @@ class AnnotationProcessor : AbstractProcessor() {
/* It's getting the target class from the annotation. */
val (targetClass, filterList, editableFields, parameterIterable) = getAnnotationFieldsForEntity(MapToEntity::class.java)

if (filterList.any { editableFields.contains(it) }) compilerError("Mappy Error: Editable Field can not be set as an exclusive field!")
if (filterList.any { editableFields.contains(it) })
compilerError("Mappy Error: Editable Field can not be set as an exclusive field!")


fileBuilder.addFunction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,4 @@ class MapperCandidate private constructor(val originatingElement: TypeElement) {
/* It's extracting Kotlin metadata from the originating element. */
private val metadata: KotlinClassMetadata = extractKotlinMetadata(originatingElement)!!

val simpleName by lazy { originatingElement.simpleName.toString() }

}

0 comments on commit 141b8da

Please sign in to comment.