cailin186 / reflections

Automatically exported from code.google.com/p/reflections
Do What The F*ck You Want To Public License
0 stars 0 forks source link

Support to get field access modifiers in MetadataAdapter #110

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi.

Could you add support to get field modifiers in MetadataAdapter interface?

I need to scan only fields that are static for certain annotation. I've 
implemented Scanner, but cannot find any clean way to check if field is static.

Right now i'm using a hack that assumes that getFields() return JavaAssist 
FieldInfo objects, but this will fail if you change JavaAssist to some other 
provider (and I assume that you created MetadataAdapter to keep your API 
independent of JavaAssist).

Thanks,
Marek.

Original issue reported on code.google.com by Marek.Pi...@gmail.com on 26 Apr 2012 at 11:59

GoogleCodeExporter commented 9 years ago
(0.9.7-RC1)

you can use 

getAllMethods(
    reflections.getAllFieldsAnnotatedWith(Some.class), withModifier(Modifier.Static))

(with import static org.reflections.ReflectionsUtils;)

closing the issue

Original comment by ronm...@gmail.com on 2 May 2012 at 3:41