In my Android app, I use Kotlin with SugarORM and I ran into a problem trying to prevent some properties from being saved. Oddly enough, the annotation is @com.orm.dsl.Ignoreapparently ignored when used in Kotlin classes.
As an example,
1) let them announce two seemingly identical models:
public class JavaUser extends SugarRecord {
public String login = "login";
@Ignore public String password = "password";
}
class KotlinUser : SugarRecord() {
var login: String = "login"
@Ignore var password: String = "password"
}
2) keep their instances
JavaUser().save()
KotlinUser().save()
3) and see what actually persists:
sqlite> select * from java_user;
ID|LOGIN
1|login
sqlite> select * from kotlin_user;
ID|LOGIN|PASSWORD
1|login|password
I understand that this may be due to the processing of the Kotlin annotation, but I'm just not sure how I can do this. Any suggestions are welcome.
source
share