private boolean isCtFieldACollection ( CtField ctField ) { try { return ctField . getType ( ) . equals ( cp . get ( Collection . class . getName ( ) ) ) || ctField . getType ( ) . equals ( cp . get ( List . class . getName ( ) ) ) || ctField . getType ( ) . equals ( cp . get ( Set . class . getName ( ) ) ) ; } catch ( NotFoundException e ) { e . printStackTrace ( ) ; return false ; } }
Verify that CtField is exactly the java . util . Collection java . util . List or java . util . Set otherwise cannot instrument the class field