I have a Field field object.
I want to check if field object of type Foo or an array: Foo[] .
Psuedo Code:
if field.getType() is Foo || field.getType is Foo[]
Is it possible?
I tried
if (field.getType().isArray()) // do something
But that would allow me to check if there is a field array.
Doing this, by contrast, only checks the Foo object
if (Foo.class.isAssignableFrom(field.getType()) // do something
Any idea how to do this?
Thanks.
java reflection field
One two three
source share