Microsoft SDK for Java

ReflectionPermission Class

The ReflectionPermission Class of the com.ms.security.permissions package represents a permission that controls the ability to perform reflection operations. The StandardSecurityManager checks for this permission type when performing the checkMemberAccess operation.

public class ReflectionPermission implements IPermission,
            IEncodablePermission, IAdjustablePermission
{
  // Fields
  public static int ALL;
  public static int DIFFERENTLOADER;
  public static int NONE;
  public static int SAMELOADER;
  public static int SYSTEMLOADER;

  // Constructors
  public ReflectionPermission();

  // Methods
  public void adjustPermission(String tag, Object adjustment);
  public void check(Object param);
  public IPermission combine(IPermission source2);
  public int compareSet(Object target);
  public IPermission copy();
  public boolean decode(String tag, InputStream data);
  public boolean encode(String tag, OutputStream out);
  public int getAllowedAccess(int accessType);
  public int getAllowedDeclaredAccess();
  public int getAllowedPublicAccess();
  public ClassLoader getAssociatedLoader();
  public String mapFormat(String format);
  public void reset();
  public void setAllowedDeclaredAccess(int loadertypes);
  public void setAllowedPublicAccess(int loadertypes);
  public void setAssociatedLoader(ClassLoader ldr);
  public String[] supportedFormats();
  public String toString();
}

A ReflectionPermission distinguishes between two different types of reflection operations:

Public

Reflective access to a public member of some class. This type of access is specified by the constant java.lang.reflect.Member.PUBLIC.

Declared

Reflective access to any member of a given class. This type of access is specified by the constant java.lang.reflect.Member.DECLARED.

A ReflectionPermission object further distinguishes between types of reflection operations, depending on the type of class being reflected. The types of classes that can be reflected are as follows:

SAMELOADER

A class from the same loader as the class initiating the reflection operation.

DIFFERENTLOADER

A non-system class from a loader other than that of the class that is initiating the reflection operation.

SYSTEMLOADER

A System class.

See Also

com.ms.security.permissions.ReflectionRequest

© 1999 Microsoft Corporation. All rights reserved. Terms of use.