Hi! 👋 This might be a dumb question, but is it possible to annotate and auto-generate serializers for a POJO class in a java file?
I am trying something like this
Copy code
// MainActivity.java
public class MainActivity extends Activity {
@Serializable
static class Props {
// my POJO
int count;
String name;
}
@Override
public void onCreate() {
super.onCreate();
Props.serializer() // No such method available
}
}
I am not sure if i am misusing / misunderstanding the API here, so feel free to correct 🙂
Thx!
n
Nikky
04/14/2021, 4:48 PM
serialization does its magic as a compiler plugin.. so if it is not a in file processed by kotlinc.. the magic does not happen
Nikky
04/14/2021, 4:48 PM
why not extract it as a data class into a
.kt
file ?
🙌 1
p
Prayansh Srivastava
04/14/2021, 9:16 PM
yea i think thats probably what i will end up doing, was just wondering if the compiler plugin can work on java files.
thx for the answer 🙂