Class MatchRule

    • Field Detail

      • ALL

        public static final MatchRule ALL
        The root rule which matches all URIs.
    • Constructor Detail

    • Method Detail

      • equals

        public final boolean equals​(Object other)
        Determine whether this rule is equal to another object. Two rules are equal if they match the same conditions.
        Overrides:
        equals in class Object
        Parameters:
        other - the other object
        Returns:
        true if they are equal, false otherwise
      • equals

        public final boolean equals​(MatchRule other)
        Determine whether this rule is equal to another. Two rules are equal if they match the same conditions.
        Parameters:
        other - the other object
        Returns:
        true if they are equal, false otherwise
      • halfEqual

        abstract boolean halfEqual​(MatchRule other)
      • parentHalfEqual

        final boolean parentHalfEqual​(MatchRule other)
      • hashCode

        public abstract int hashCode()
        Get the hash code of this rule.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code
      • parentHashCode

        final int parentHashCode()
      • matches

        public final boolean matches​(URI uri)
        Determine if this rule matches the given URI.
        Parameters:
        uri - the URI to test
        Returns:
        true if the rule matches, false otherwise
      • matches

        public boolean matches​(URI uri,
                               String abstractType,
                               String abstractTypeAuthority)
        Determine if this rule matches the given URI, and type.
        Parameters:
        uri - the URI to test
        abstractType - the abstract type of the connection (may be null)
        abstractTypeAuthority - the authority name of the abstract type (may be null)
        Returns:
        true if the rule matches, false otherwise
      • isProtocolMatched

        public boolean isProtocolMatched()
        Determine whether this rule matches based on URI protocol (scheme).
        Returns:
        true if the rule matches based on URI protocol, false otherwise
      • getMatchProtocol

        public String getMatchProtocol()
        Get the protocol (scheme) that this rule matches, or null if this rule does not match by protocol.
        Returns:
        the protocol, or null if there is none
      • isTypeMatched

        public boolean isTypeMatched()
        Determine whether this rule matches based on abstract type.
        Returns:
        true if the rule matches based on type, false otherwise
      • isTypeAuthorityMatched

        public boolean isTypeAuthorityMatched()
        Determine whether this rule matches based on abstract type.
        Returns:
        true if the rule matches based on type, false otherwise
      • getMatchAbstractType

        public String getMatchAbstractType()
        Get the abstract type that this rule matches, or null if this rule does not match by abstract type.
        Returns:
        the abstract type, or null if there is none
      • getMatchAbstractTypeAuthority

        public String getMatchAbstractTypeAuthority()
        Get the abstract type authority that this rule matches, or null if this rule does not match by abstract type authority.
        Returns:
        the abstract type, or null if there is none
      • matchProtocol

        public final MatchRule matchProtocol​(String protoName)
        Create a new rule which is the same as this rule, but also matches the given protocol (scheme) name.
        Parameters:
        protoName - the protocol name to match
        Returns:
        the new rule
      • matchAbstractType

        public final MatchRule matchAbstractType​(String typeName,
                                                 String authorityName)
        Create a new rule which is the same as this rule, but also matches the given abstract type and type authority.
        Parameters:
        typeName - the type to match
        authorityName - the type authority name to match
        Returns:
        the new rule
      • isHostMatched

        public boolean isHostMatched()
        Determine whether this rule matches based on host name.
        Returns:
        true if the rule matches based on host name, false otherwise
      • getMatchHost

        public String getMatchHost()
        Get the host name that this rule matches, or null if this rule does not match by host.
        Returns:
        the host name, or null if there is none
      • isNetworkMatched

        public boolean isNetworkMatched()
        Determine whether this rule matches based on network.
        Returns:
        true if the rule matches based on network, false otherwise
      • getMatchNetwork

        public org.wildfly.common.net.CidrAddress getMatchNetwork()
        Get the network that this rule matches, or null if this rule does not match by network.
        Returns:
        the network that this rule matches, or null if there is none
      • matchHost

        public final MatchRule matchHost​(String hostSpec)
        Create a new rule which is the same as this rule, but also matches the given host name. If the given string appears to be an IP address or a CIDR network specification, then it is treated as such.
        Parameters:
        hostSpec - the host name to match
        Returns:
        the new rule
      • matchAddress

        public final MatchRule matchAddress​(InetAddress inetAddress)
        Create a new rule which is the same as this rule, but also matches the given Internet address.
        Parameters:
        inetAddress - the address to match
        Returns:
        the new rule
      • matchNetwork

        public final MatchRule matchNetwork​(org.wildfly.common.net.CidrAddress cidrAddress)
        Create a new rule which is the same as this rule, but also matches the given Internet network address.
        Parameters:
        cidrAddress - the network to match
        Returns:
        the new rule
      • isPathMatched

        public boolean isPathMatched()
        Determine whether this rule matches based on path name.
        Returns:
        true if the rule matches based on path name, false otherwise
      • getMatchPath

        public String getMatchPath()
        Get the path name that this rule matches, or null if this rule does not match by path.
        Returns:
        the path name, or null if there is none
      • matchPath

        public final MatchRule matchPath​(String pathSpec)
        Create a new rule which is the same as this rule, but also matches the given path name.
        Parameters:
        pathSpec - the path name to match
        Returns:
        the new rule
      • isPortMatched

        public boolean isPortMatched()
        Determine whether this rule matches based on port.
        Returns:
        true if the rule matches based on port, false otherwise
      • getMatchPort

        public int getMatchPort()
        Get the port number that this rule matches, or 0 if this rule does not match by port.
        Returns:
        the port number, or 0 if there is none
      • matchPort

        public final MatchRule matchPort​(int port)
        Create a new rule which is the same as this rule, but also matches the given port number. The port number must be between 1 and 65535 (inclusive).
        Parameters:
        port - the port to match
        Returns:
        the new rule
      • isUserMatched

        public boolean isUserMatched()
        Determine whether this rule matches based on non-empty URI user info.
        Returns:
        true if the rule matches based on non-empty user info, false otherwise
      • getMatchUser

        public String getMatchUser()
        Get the URI user info that this rule matches, or null if this rule only matches empty URI user info.
        Returns:
        the user info, or null if there is none
      • matchUser

        public final MatchRule matchUser​(String userSpec)
        Create a new rule which is the same as this rule, but also matches the given URI user info.
        Parameters:
        userSpec - the user info to match
        Returns:
        the new rule
      • matchNoUser

        public final MatchRule matchNoUser()
        Create a new rule which is the same as this rule, but only matches URIs with no user info.
        Returns:
        the new rule
      • matchAnyUser

        public final MatchRule matchAnyUser()
        Create a new rule which is the same as this rule, but matches URIs with or without user info.
        Returns:
        the new rule
      • isUrnNameMatched

        public boolean isUrnNameMatched()
        Determine whether this rule matches based on URN name.
        Returns:
        true if the rule matches based on URN name, false otherwise
      • getMatchUrnName

        public String getMatchUrnName()
        Get the URN name that this rule matches, or null if this rule does not match by URN.
        Returns:
        the URN name, or null if there is none
      • matchUrnName

        public final MatchRule matchUrnName​(String name)
        Create a new rule which is the same as this rule, but also matches the given URN name.
        Parameters:
        name - the URN name to match
        Returns:
        the new rule
      • matchLocalSecurityDomain

        public final MatchRule matchLocalSecurityDomain​(String name)
        Create a new rule which is the same as this rule, but also matches the given security domain.
        Parameters:
        name - the security domain name to match
        Returns:
        the new rule
      • toString

        public final String toString()
        Get the string representation of this rule.
        Overrides:
        toString in class Object
        Returns:
        the string representation of this rule