Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.3.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## java.security
Class ProtectionDomain

    java.lang.Object
      |
      +--java.security.ProtectionDomain

public class ProtectionDomain
extends Object

This ProtectionDomain class encapulates the characteristics of a domain, which encloses a set of classes whose instances are granted the same set of permissions.

In addition to a set of permissions, a domain is comprised of a CodeSource, which is a set of PublicKeys together with a codebase (in the form of a URL). Thus, classes signed by the same keys and from the same URL are placed in the same domain. Classes that have the same permissions but are from different code sources belong to different domains.

A class belongs to one and only one ProtectionDomain.

Constructor Summary
`ProtectionDomain(CodeSource codesource, PermissionCollection permissions)` Creates a new ProtectionDomain with the given CodeSource and Permissions.

Method Summary
`CodeSource` | `getCodeSource()` Returns the CodeSource of this domain.
`PermissionCollection` | `getPermissions()` Returns the permissions of this domain.
`boolean` | `implies(Permission permission)` Check and see if this ProtectionDomain implies the permissions expressed in the Permission object.
`String` | `toString()` Convert a ProtectionDomain to a String.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ProtectionDomain

    public ProtectionDomain(CodeSource codesource,
                            PermissionCollection permissions)

  Creates a new ProtectionDomain with the given CodeSource and Permissions. If the permissions object is not null, then `setReadOnly()` will be called on the passed in Permissions object.
  Parameters:
    `codesource` - the codesource associated with this domain
    `permissions` - the permissions granted to this domain

Method Detail

### getCodeSource

    public final CodeSource getCodeSource()

  Returns the CodeSource of this domain.
  Returns:
    the CodeSource of this domain.

### getPermissions

    public final PermissionCollection getPermissions()

  Returns the permissions of this domain.
  Returns:
    the permissions of this domain.

### implies

    public boolean implies(Permission permission)

  Check and see if this ProtectionDomain implies the permissions expressed in the Permission object.
  Parameters:
    `permission` - the Permission object to check.
  Returns:
    true if "permission" is a proper subset of a permission in this ProtectionDomain, false if not.

### toString

    public String toString()

  Convert a ProtectionDomain to a String.
  Overrides:
    `toString` in class `Object`
  Following copied from class: `java.lang.Object`
  Returns:
    a string representation of the object.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.3.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.