I'm writting a library for converting a cursor (returned by a raw sqlite query) to a room persistance object. In order to do this I am using refelction to get information about the Room entity a cursor is to map
I have hit an issue as it appears that @ColumnInfo, @Ignore, and most, if not all of Room's annotation are using "RetentionPolicy.CLASS". This means I cannot access them through refelection.
For example I would like to request the name
value from the @ColumnInfo
annotation of specific field. Currently running something along the lines of :
for (Field field : entityClassType.getDeclaredFields()) {
Annotation[] a = field.getDeclaredAnnotations();
}
Will give me a
of size zero as RetentionPolicy.CLASS
objects are not returened by getDeclaredAnnotations
Is there anyway of accessing these fields, or an alternative approach to getting this information.
P.S. I do not want to modify/extend/recreate the annotations as this is expressly mean to be working with Room's annotations.
Aucun commentaire:
Enregistrer un commentaire