Package org.apache.kafka.common.resource
Class ResourcePatternFilter
- java.lang.Object
-
- org.apache.kafka.common.resource.ResourcePatternFilter
-
@Evolving public class ResourcePatternFilter extends java.lang.Object
Represents a filter that can matchResourcePattern.The API for this class is still evolving and we may break compatibility in minor releases, if necessary.
-
-
Field Summary
Fields Modifier and Type Field Description static ResourcePatternFilterANYMatches any resource pattern.
-
Constructor Summary
Constructors Constructor Description ResourcePatternFilter(ResourceType resourceType, java.lang.String name, PatternType patternType)Create a filter using the supplied parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.StringfindIndefiniteField()inthashCode()booleanisUnknown()booleanmatches(ResourcePattern pattern)booleanmatchesAtMostOne()java.lang.Stringname()PatternTypepatternType()ResourceTyperesourceType()java.lang.StringtoString()
-
-
-
Field Detail
-
ANY
public static final ResourcePatternFilter ANY
Matches any resource pattern.
-
-
Constructor Detail
-
ResourcePatternFilter
public ResourcePatternFilter(ResourceType resourceType, java.lang.String name, PatternType patternType)
Create a filter using the supplied parameters.- Parameters:
resourceType- non-null resource type. IfResourceType.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 ornull. Ifnull, the filter will ignore the name of resources. IfResourcePattern.WILDCARD_RESOURCE, will match only wildcard patterns.patternType- non-null resource pattern type. IfPatternType.ANY, the filter will match patterns regardless of pattern type. IfPatternType.MATCH, the filter will match patterns that would match the suppliedname, 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:
trueif this filter has any UNKNOWN components.
-
resourceType
public ResourceType resourceType()
- Returns:
- the specific resource type this pattern matches
-
name
public java.lang.String name()
- Returns:
- the resource name.
-
patternType
public PatternType patternType()
- Returns:
- the resource pattern type.
-
matches
public boolean matches(ResourcePattern pattern)
- Returns:
trueif this filter matches the given pattern.
-
matchesAtMostOne
public boolean matchesAtMostOne()
- Returns:
trueif this filter could only match one pattern. In other words, if there are no ANY or UNKNOWN fields.
-
findIndefiniteField
public java.lang.String findIndefiniteField()
- Returns:
- a string describing any ANY or UNKNOWN field, or null if there is no such field.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-