Example usage for java.util PropertyPermission implies

List of usage examples for java.util PropertyPermission implies

Introduction

In this page you can find the example usage for java.util PropertyPermission implies.

Prototype

@Override
public boolean implies(Permission p) 

Source Link

Document

Checks if this PropertyPermission object "implies" the specified permission.

Usage

From source file:Main.java

public static void main(String[] args) {
    PropertyPermission permission = new PropertyPermission("java.*", "read,write");

    if (permission.implies(new PropertyPermission("java.home", "read"))) {
        System.out.println("Has permissions on " + "java.home" + " for read");
    }/*from w w w  . j  ava 2  s .  c o m*/

    // Check permission on read action
    if (permission.implies(new PropertyPermission("java.home", "write"))) {
        System.out.println("Has permissions on " + "java.home" + " for write");
    }
}