Guard
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
AllPermission,
BasicPermission,
FilePermission,
LinkPermission,
LoggingPermission,
NetPermission,
Permission,
PrivateCredentialPermission,
PropertyPermission,
ReflectPermission,
RuntimePermission,
SQLPermission,
SecurityPermission,
SerializablePermission,
SocketPermission
|
This interface represents a guard, which is an object that is used
to protect access to another object.
This interface contains a single method, checkGuard
,
with a single object
argument. checkGuard
is
invoked (by the GuardedObject getObject
method)
to determine whether or not to allow access to the object.
Public Method Summary
abstract
void
|
checkGuard( Object object)
Determines whether or not to allow access to the guarded object
object .
|
Public Methods
public
abstract
void
checkGuard
(Object object)
Determines whether or not to allow access to the guarded object
object
. Returns silently if access is allowed.
Otherwise, throws a SecurityException.
Parameters
object |
the object being protected by the guard. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eGuard\u003c/code\u003e interface is used for protecting access to an object through the \u003ccode\u003echeckGuard\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003echeckGuard\u003c/code\u003e determines if access to the guarded object is allowed, throwing a SecurityException if denied.\u003c/p\u003e\n"],["\u003cp\u003eMost known subclasses of \u003ccode\u003eGuard\u003c/code\u003e are legacy security code and are not recommended for use on Android.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eLinkPermission\u003c/code\u003e is an exception and is used for link creation operations.\u003c/p\u003e\n"]]],[],null,["public interface **Guard** \n\n|---|---|---|\n| Known Indirect Subclasses [AllPermission](../../../reference/java/security/AllPermission.html), [BasicPermission](../../../reference/java/security/BasicPermission.html), [FilePermission](../../../reference/java/io/FilePermission.html), [LinkPermission](../../../reference/java/nio/file/LinkPermission.html), [LoggingPermission](../../../reference/java/util/logging/LoggingPermission.html), [NetPermission](../../../reference/java/net/NetPermission.html), [Permission](../../../reference/java/security/Permission.html), [PrivateCredentialPermission](../../../reference/javax/security/auth/PrivateCredentialPermission.html), [PropertyPermission](../../../reference/java/util/PropertyPermission.html), [ReflectPermission](../../../reference/java/lang/reflect/ReflectPermission.html), [RuntimePermission](../../../reference/java/lang/RuntimePermission.html), [SQLPermission](../../../reference/java/sql/SQLPermission.html), [SecurityPermission](../../../reference/java/security/SecurityPermission.html), [SerializablePermission](../../../reference/java/io/SerializablePermission.html), [SocketPermission](../../../reference/java/net/SocketPermission.html) |--------------------------------------------------------------------------------------------------------|------------------------------------------------------| | [AllPermission](../../../reference/java/security/AllPermission.html) | Legacy security code; do not use. | | [BasicPermission](../../../reference/java/security/BasicPermission.html) | Legacy security code; do not use. | | [FilePermission](../../../reference/java/io/FilePermission.html) | Legacy security code; do not use. | | [LinkPermission](../../../reference/java/nio/file/LinkPermission.html) | The `Permission` class for link creation operations. | | [LoggingPermission](../../../reference/java/util/logging/LoggingPermission.html) | Legacy security code; do not use. | | [NetPermission](../../../reference/java/net/NetPermission.html) | Legacy security code; do not use. | | [Permission](../../../reference/java/security/Permission.html) | Legacy security code; do not use. | | [PrivateCredentialPermission](../../../reference/javax/security/auth/PrivateCredentialPermission.html) | Legacy security code; do not use. | | [PropertyPermission](../../../reference/java/util/PropertyPermission.html) | Legacy security code; do not use. | | [ReflectPermission](../../../reference/java/lang/reflect/ReflectPermission.html) | Legacy security code; do not use. | | [RuntimePermission](../../../reference/java/lang/RuntimePermission.html) | Legacy security code; do not use. | | [SQLPermission](../../../reference/java/sql/SQLPermission.html) | Legacy security code; do not use. | | [SecurityPermission](../../../reference/java/security/SecurityPermission.html) | Legacy security code; do not use. | | [SerializablePermission](../../../reference/java/io/SerializablePermission.html) | This legacy security is not supported on Android. | | [SocketPermission](../../../reference/java/net/SocketPermission.html) | Legacy security code; do not use. | |||\n\n\u003cbr /\u003e\n\nThis interface represents a guard, which is an object that is used\nto protect access to another object.\n\nThis interface contains a single method, `checkGuard`,\nwith a single `object` argument. `checkGuard` is\ninvoked (by the GuardedObject `getObject` method)\nto determine whether or not to allow access to the object. \n\nSee Also\n\n- [GuardedObject](../../../reference/java/security/GuardedObject.html) \n\nPublic Method Summary\n\n|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [checkGuard](../../../reference/java/security/Guard.html#checkGuard(java.lang.Object))([Object](../../../reference/java/lang/Object.html) object) Determines whether or not to allow access to the guarded object `object`. |\n\nPublic Methods \n\npublic abstract void\n**checkGuard**\n([Object](../../../reference/java/lang/Object.html) object) \nDetermines whether or not to allow access to the guarded object\n`object`. Returns silently if access is allowed.\nOtherwise, throws a SecurityException. \n\nParameters\n\n| object | the object being protected by the guard. |\n|--------|------------------------------------------|\n\nThrows\n\n| [SecurityException](../../../reference/java/lang/SecurityException.html) | if access is denied. |\n|--------------------------------------------------------------------------|----------------------|"]]