Class CardPermission

    • Constructor Detail

      • CardPermission

        public CardPermission​(String terminalName,
                              String actions)
        Constructs a new CardPermission with the specified actions. terminalName is the name of a CardTerminal or * if this permission applies to all terminals. actions contains a comma-separated list of the individual actions or * to signify all actions. For more information, see the documentation at the top of this class.
        Parameters:
        terminalName - the name of the card terminal, or *
        actions - the action string (or null if the set of permitted actions is empty)
        Throws:
        NullPointerException - if terminalName is null
        IllegalArgumentException - if actions is an invalid actions specification
    • Method Detail

      • getActions

        public String getActions()
        Returns the canonical string representation of the actions. It is * to signify all actions defined by this class or the string concatenation of the comma-separated, lexicographically sorted list of individual actions.
        Specified by:
        getActions in class Permission
        Returns:
        the canonical string representation of the actions.
      • implies

        public boolean implies​(Permission permission)
        Checks if this CardPermission object implies the specified permission. That is the case, if and only if
        • permission is an instance of CardPermission,

        • permission's actions are a proper subset of this object's actions, and

        • this object's getName() method is either * or equal to permission's name.

        Specified by:
        implies in class Permission
        Parameters:
        permission - the permission to check against
        Returns:
        true if and only if this CardPermission object implies the specified permission.
      • equals

        public boolean equals​(Object obj)
        Compares the specified object with this CardPermission for equality. This CardPermission is equal to another Object object, if and only if
        • object is an instance of CardPermission,

        • this.getName() is equal to ((CardPermission)object).getName(), and

        • this.getActions() is equal to ((CardPermission)object).getActions().

        Specified by:
        equals in class Permission
        Parameters:
        obj - the object to be compared for equality with this CardPermission
        Returns:
        true if and only if the specified object is equal to this CardPermission
        See Also:
        Object.hashCode(), HashMap