示例#1
0
  /**
   * Checks if this ExecPermission object "implies" the specified permission.
   *
   * <p>More specifically, this method returns true if:
   *
   * <p>
   *
   * <ul>
   *   <li><i>p</i> is an instanceof ExecPermission,
   *       <p>and
   *   <li><i>p</i>'s pathname is implied by this object's pathname. For example, "/tmp/*" implies
   *       "/tmp/foo", since "/tmp/*" encompasses the "/tmp" directory and all files in that
   *       directory, including the one named "foo".
   * </ul>
   *
   * @param p the permission to check against.
   * @return true if the specified permission is implied by this object, false if not.
   */
  public boolean implies(Permission p) {
    if (!(p instanceof ExecPermission)) return false;

    ExecPermission that = (ExecPermission) p;

    return fp.implies(that.fp);
  }
示例#2
0
  /**
   * Checks two ExecPermission objects for equality. Checks that <i>obj</i>'s class is the same as
   * this object's class and has the same name as this object.
   *
   * <p>
   *
   * @param obj the object we are testing for equality with this object.
   * @return true if <i>obj</i> is an ExecPermission, and has the same pathname as this
   *     ExecPermission object, false otherwise.
   */
  public boolean equals(Object obj) {
    if (obj == this) return true;

    if (!(obj instanceof ExecPermission)) return false;

    ExecPermission that = (ExecPermission) obj;

    return fp.equals(that.fp);
  }