Back to project page Dumbledroid.
The source code is released under:
Copyright (c) 2013, Leocadio Tin? All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...
If you think the Android project Dumbledroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package io.leocad.dumbledroid.data; //from ww w.j a v a 2 s . c o m import java.lang.reflect.Field; public class ReflectionHelper { public static Field getField(Class<?> fieldClass, String fieldName) throws NoSuchFieldException { final Field field = fieldClass.getDeclaredField(fieldName); field.setAccessible(true); return field; } public static Field getFieldInHierarchy(Class<?> fieldClass, String fieldName) throws NoSuchFieldException { try { return getField(fieldClass, fieldName); } catch (NoSuchFieldException e) { final Class<?> superClass = fieldClass.getSuperclass(); if(superClass == null) { throw e; } return getFieldInHierarchy(superClass, fieldName); } } public static Field[] getAllFields(Class<?> fieldClass) { final Field[] fields = fieldClass.getDeclaredFields(); for(final Field field : fields) { field.setAccessible(true); } return fields; } }