Top Description Fields Constructors Methods
sun.security.util

public final Class LazyCodeSourcePermissionCollection

extends PermissionCollection
Class Inheritance
Imports
java.io.File, .FilePermission, .IOException, java.net.URL, java.security.CodeSource, .Permission, .PermissionCollection, java.util.Enumeration

This PermissionCollection implementation delegates to another PermissionCollection, taking care to lazily add the permission needed to read from the given CodeSource at first use, i.e., when either of elements, implies or toString is called, or when the collection is serialized.

Field Summary

Modifier and TypeField and Description
private final CodeSource
private volatile boolean
private final PermissionCollection
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
add(Permission
the Permission object to add.
permission
)

Implements abstract java.security.PermissionCollection.add.

Adds a permission object to the current collection of permission objects.

public Enumeration<Permission>
elements()

Implements abstract java.security.PermissionCollection.elements.

Returns an enumeration of all the Permission objects in the collection.

private void
public boolean
implies(Permission
the Permission object to compare.
permission
)

Implements abstract java.security.PermissionCollection.implies.

Checks to see if the specified permission is implied by the collection of Permission objects held in this PermissionCollection.

public String
toString()

Overrides java.security.PermissionCollection.toString.

Returns a string describing this PermissionCollection object, providing information about all the permissions it contains.

private Object
writeReplace()

On serialization, initialize and replace with the underlying permissions.

Inherited from java.security.PermissionCollection:
elementsAsStreamisReadOnlysetReadOnly

Field Detail

csback to summary
private final CodeSource cs
permissionAddedback to summary
private volatile boolean permissionAdded
permsback to summary
private final PermissionCollection perms
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.PermissionCollection.serialVersionUID.

Annotations
@Serial

Constructor Detail

LazyCodeSourcePermissionCollectionback to summary
public LazyCodeSourcePermissionCollection(PermissionCollection perms, CodeSource cs)

Method Detail

addback to summary
public void add(Permission permission)

Implements abstract java.security.PermissionCollection.add.

Doc from java.security.PermissionCollection.add.

Adds a permission object to the current collection of permission objects.

Parameters
permission:Permission

the Permission object to add.

Annotations
@Override
elementsback to summary
public Enumeration<Permission> elements()

Implements abstract java.security.PermissionCollection.elements.

Doc from java.security.PermissionCollection.elements.

Returns an enumeration of all the Permission objects in the collection.

Returns:Enumeration<Permission>

an enumeration of all the Permissions.

Annotations
@Override
ensureAddedback to summary
private void ensureAdded()
impliesback to summary
public boolean implies(Permission permission)

Implements abstract java.security.PermissionCollection.implies.

Doc from java.security.PermissionCollection.implies.

Checks to see if the specified permission is implied by the collection of Permission objects held in this PermissionCollection.

Parameters
permission:Permission

the Permission object to compare.

Returns:boolean

true if "permission" is implied by the permissions in the collection, false if not.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.security.PermissionCollection.toString.

Doc from java.security.PermissionCollection.toString.

Returns a string describing this PermissionCollection object, providing information about all the permissions it contains. The format is:

super.toString() (
  // enumerate all the Permission
  // objects and call toString() on them,
  // one per line..
)
super.toString is a call to the toString method of this object's superclass, which is Object. The result is this collection's type name followed by this object's hashcode, thus enabling clients to differentiate different PermissionCollection objects, even if they contain the same permissions.
Returns:String

information about this PermissionCollection object, as described above.

Annotations
@Override
writeReplaceback to summary
private Object writeReplace()

On serialization, initialize and replace with the underlying permissions. This removes the laziness on deserialization.

Annotations
@Serial