FranzGames / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

I need to implement GSON serialization filtering based on template. in GSON. in GSON exclusionStrategy , shouldSkipField , I need to know field's concrete class, where am I in class hierarchy #528

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
. My class structure is as following:-  
class A{ 
  String id; }  
class B{ 
   String bb; 
   String bbb; }  
class c extends A{ 
    String cVal; 
    B  bObj; }   

I want to access 'id' field via class c, but id field's declaring class comes 
as A instead of c

Original issue reported on code.google.com by preetiag...@gmail.com on 17 Jul 2013 at 4:23

GoogleCodeExporter commented 9 years ago
can't you do f.getDeclaringClass().isAssignableFrom(c.class)?

Original comment by haripr...@gmail.com on 28 Jul 2013 at 12:57