samedi 26 mars 2016

public static runtime incremental change - android

I have a simple class named A which has two private fields.

public class A {

    private String a;
    private String b;
} // A

When I get all declared fields from class instance, I get one extra field named $change. Where is it coming from ? I am totally not getting this.

Field[] fields = cls.getDeclaredFields();
        for (int i = 0, len = fields.length; i < len; i++) {
            Field field = fields[i];
            field.setAccessible(true);
            Log.d("TAG", field.getName());
            if (field.isAnnotationPresent(Primary.class)) {
                query += getFromalName(field.getName()).toUpperCase() + " " + getSchemaType(field.getType().getSimpleName()) + " PRIMARY KEY, ";
                continue;
            }
            if (field.isAnnotationPresent(NotNull.class)) {
                query += getFromalName(field.getName()) + " " + getSchemaType(field.getType().getSimpleName()) + " NOT NULL, ";
                continue;
            }
            query += getFromalName(field.getName()) + " " + getSchemaType(field.getType().getSimpleName()) + ", ";
        } // end for

        query = query.substring(0, query.lastIndexOf(","));
        query += " )";

Here is the snapshot

Snapshot 2





Aucun commentaire:

Enregistrer un commentaire