/** * Returns a {@link List} of {@link FieldSub}s for each * field declared field in the inspected class. However, * in safe mode (which *is* the default), this will only return * the public fields. You must configure safe mode to be off * to receive a list of all fields. * @return fields inspectors list */ public List<FieldSub> getFields() { if (fields == null) { Field[] declared = getType().getDeclaredFields(); List<FieldSub> subs = new ArrayList<FieldSub>(declared.length); for (Field field : declared) { FieldSub sub = new FieldSub(field); if ((!isSafeMode() || sub.isPublic()) && (showDeprecated || !sub.isDeprecated())) { subs.add(sub); } } Collections.sort(subs); fields = Collections.unmodifiableList(subs); } return fields; }
/** * Returns the value of the field if and only if * it is a static field that has no access restrictions * set by the security manager. * @return value of static field */ public Object getStaticValue() { if (isStatic()) { try { return field.get(null); } catch(IllegalAccessException iae) { //ignore } } return null; }