Example usage for java.util PropertyPermission getActions

List of usage examples for java.util PropertyPermission getActions

Introduction

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

Prototype

@Override
public String getActions() 

Source Link

Document

Returns the "canonical string representation" of the actions.

Usage

From source file:Main.java

public static void main(String[] args) {

    PropertyPermission permission = new PropertyPermission("java.home.*", "read,write");

    if ("java.home.usr".matches(permission.getName())) {
        String actions = permission.getActions();

        if (actions.contains("read")) {
            System.out.println("Has permissions on java.home.usr for read");
        }//  w  w  w . j a  va  2  s  .com

        if (actions.contains("write")) {
            System.out.println("Has permissions on java.home.usr for write");
        }
    }
}