Class ResourcePatternFilter


  • @Evolving
    public class ResourcePatternFilter
    extends Object
    Represents a filter that can match ResourcePattern.

    The API for this class is still evolving and we may break compatibility in minor releases, if necessary.

    • Constructor Detail

      • ResourcePatternFilter

        public ResourcePatternFilter​(ResourceType resourceType,
                                     String name,
                                     PatternType patternType)
        Create a filter using the supplied parameters.
        Parameters:
        resourceType - non-null resource type. If ResourceType.ANY, the filter will ignore the resource type of the pattern. If any other resource type, the filter will match only patterns with the same type.
        name - resource name or null. If null, the filter will ignore the name of resources. If ResourcePattern.WILDCARD_RESOURCE, will match only wildcard patterns.
        patternType - non-null resource pattern type. If PatternType.ANY, the filter will match patterns regardless of pattern type. If PatternType.MATCH, the filter will match patterns that would match the supplied name, including a matching prefixed and wildcards patterns. If any other resource pattern type, the filter will match only patterns with the same type.
    • Method Detail

      • isUnknown

        public boolean isUnknown()
        Returns:
        true if this filter has any UNKNOWN components.
      • resourceType

        public ResourceType resourceType()
        Returns:
        the specific resource type this pattern matches
      • name

        public String name()
        Returns:
        the resource name.
      • patternType

        public PatternType patternType()
        Returns:
        the resource pattern type.
      • matches

        public boolean matches​(ResourcePattern pattern)
        Returns:
        true if this filter matches the given pattern.
      • matchesAtMostOne

        public boolean matchesAtMostOne()
        Returns:
        true if this filter could only match one pattern. In other words, if there are no ANY or UNKNOWN fields.
      • findIndefiniteField

        public String findIndefiniteField()
        Returns:
        a string describing any ANY or UNKNOWN field, or null if there is no such field.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object