@CallerSensitive
public Field[] getDeclaredFields () throws SecurityException

Returns an array of Field objects reflecting all the fields declared by the class or interface represented by this Class object. This includes public, protected, default (package) access, and private fields, but excludes inherited fields.

If this Class object represents a class or interface with no declared fields, then this method returns an array of length 0.

If this Class object represents an array type, a primitive type, or void, then this method returns an array of length 0.

The elements in the returned array are not sorted and are not in any particular order.

Returns:  the array of Field objects representing all the declared fields of this class

Exceptions:
SecurityException     If a security manager, s, is present and any of the following conditions is met:
  • the caller's class loader is not the same as the class loader of this class and invocation of s.checkPermission method with RuntimePermission("accessDeclaredMembers") denies access to the declared fields within this class
  • the caller's class loader is not the same as or an ancestor of the class loader for the current class and invocation of s.checkPackageAccess() denies access to the package of this class

Since:  1.1

@jls 8.2 Class Members
@jls 8.3 Field Declarations