-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move all optic generation to a single annotation
- Loading branch information
Showing
10 changed files
with
63 additions
and
83 deletions.
There are no files selected for viewing
5 changes: 3 additions & 2 deletions
5
modules/core/arrow-annotations-processor-test/src/main/java/arrow/ap/objects/Optional.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package arrow.ap.objects | ||
|
||
import arrow.OpticsTarget | ||
import arrow.core.Option | ||
import arrow.optionals | ||
import arrow.optic | ||
|
||
@optionals | ||
@optic([(OpticsTarget.OPTIONAL)]) | ||
data class Optional(val field: String, val nullable: String?, val option: Option<String>) |
5 changes: 3 additions & 2 deletions
5
...es/core/arrow-annotations-processor-test/src/main/java/arrow/ap/objects/OptionalSealed.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
package arrow.ap.objects | ||
|
||
import arrow.OpticsTarget | ||
import arrow.core.Option | ||
import arrow.optionals | ||
import arrow.optic | ||
|
||
@optionals | ||
@optic([OpticsTarget.OPTIONAL]) | ||
sealed class OptionalSealed(val field: String, val nullable: String?, val option: Option<String>) { | ||
data class Optional2(val a: String?) : OptionalSealed("", null, Option.empty()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 4 additions & 23 deletions
27
modules/core/arrow-annotations-processor/src/main/java/arrow/optics/AnnotationInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,7 @@ | ||
package arrow.optics | ||
|
||
import arrow.isos | ||
import arrow.lenses | ||
import arrow.optionals | ||
import arrow.prisms | ||
import arrow.optic | ||
|
||
val lensesAnnotationKClass = lenses::class | ||
val lensesAnnotationClass = lensesAnnotationKClass.java | ||
val lensesAnnotationName = "@" + lensesAnnotationClass.simpleName | ||
val lensesAnnotationTarget = "data class" | ||
|
||
val prismsAnnotationKClass = prisms::class | ||
val prismsAnnotationClass = prismsAnnotationKClass.java | ||
val prismsAnnotationName = "@" + prismsAnnotationClass.simpleName | ||
val prismsAnnotationTarget = "sealed class" | ||
|
||
val isosAnnotationKClass = isos::class | ||
val isosAnnotationClass = isosAnnotationKClass.java | ||
val isosAnnotationName = "@" + isosAnnotationClass.simpleName | ||
val isosAnnotationTarget = "data class" | ||
|
||
val optionalsAnnotationKClass = optionals::class | ||
val optionalsAnnotationClass = optionalsAnnotationKClass.java | ||
val optionalsAnnotationName = "@" + optionalsAnnotationClass.simpleName | ||
val optionalsAnnotationTarget = "data class" | ||
val opticsAnnotationKClass = optic::class | ||
val opticsAnnotationClass = opticsAnnotationKClass.java | ||
val opticsAnnotationName = "@" + opticsAnnotationKClass.simpleName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters