加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20090303071154/http://developer.android.com:80/reference/java/security/ProtectionDomain.html
public class

ProtectionDomain

extends Object
java.lang.Object
   ↳ java.security.ProtectionDomain

Class Overview

This class represents a domain in which classes from the same source (URL) and signed by the same keys are stored. All the classes inside are given the same permissions.

Note: a class can only belong to one and only one protection domain.

Summary

Public Constructors
ProtectionDomain(CodeSource cs, PermissionCollection permissions)
Constructs a protection domain from the given code source and the permissions that that should be granted to the classes which are encapsulated in it.
ProtectionDomain(CodeSource cs, PermissionCollection permissions, ClassLoader cl, Principal[] principals)
Constructs a protection domain from the given code source and the permissions that that should be granted to the classes which are encapsulated in it.
Public Methods
final ClassLoader getClassLoader()
Returns the ClassLoader associated with the ProtectionDomain
final CodeSource getCodeSource()
Returns the code source of this domain.
final PermissionCollection getPermissions()
Returns the permissions that should be granted to the classes which are encapsulated in this domain.
final Principal[] getPrincipals()
Returns the Principals associated with this ProtectionDomain.
boolean implies(Permission permission)
Determines whether the permission collection of this domain implies the argument permission.
String toString()
Returns a string containing a concise, human-readable description of the receiver.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ProtectionDomain (CodeSource cs, PermissionCollection permissions)

Constructs a protection domain from the given code source and the permissions that that should be granted to the classes which are encapsulated in it.

public ProtectionDomain (CodeSource cs, PermissionCollection permissions, ClassLoader cl, Principal[] principals)

Constructs a protection domain from the given code source and the permissions that that should be granted to the classes which are encapsulated in it. This constructor also allows the association of a ClassLoader and group of Principals.

Parameters
cs the CodeSource associated with this domain
permissions the Permissions associated with this domain
cl the ClassLoader associated with this domain
principals the Principals associated with this domain

Public Methods

public final ClassLoader getClassLoader ()

Returns the ClassLoader associated with the ProtectionDomain

Returns
  • ClassLoader associated ClassLoader

public final CodeSource getCodeSource ()

Returns the code source of this domain.

Returns
  • java.security.CodeSource the code source of this domain

public final PermissionCollection getPermissions ()

Returns the permissions that should be granted to the classes which are encapsulated in this domain.

Returns
  • java.security.PermissionCollection collection of permissions associated with this domain.

public final Principal[] getPrincipals ()

Returns the Principals associated with this ProtectionDomain. A change to the returned array will not impact the ProtectionDomain.

Returns
  • Principals[] Principals associated with the ProtectionDomain.

public boolean implies (Permission permission)

Determines whether the permission collection of this domain implies the argument permission.

Parameters
permission java.security.Permission the permission to check.
Returns
  • boolean true if this permission collection implies the argument and false otherwise.

public String toString ()

Returns a string containing a concise, human-readable description of the receiver.

Returns
  • String a printable representation for the receiver.