PropertyPermission.getActions() has the following syntax.
public String getActions()
In the following code shows how to use PropertyPermission.getActions() method.
// w ww.j av a 2 s . co m import java.util.PropertyPermission; public class Main { 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"); } if (actions.contains("write")){ System.out.println("Has permissions on java.home.usr for write"); } } } }
The code above generates the following result.