Package org.apache.kafka.common.resource
Class ResourcePatternFilter
- java.lang.Object
-
- org.apache.kafka.common.resource.ResourcePatternFilter
-
@Evolving public class ResourcePatternFilter extends 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 ResourcePatternFilter
ANY
Matches any resource pattern.
-
Constructor Summary
Constructors Constructor Description ResourcePatternFilter(ResourceType resourceType, String name, PatternType patternType)
Create a filter using the supplied parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
findIndefiniteField()
int
hashCode()
boolean
isUnknown()
boolean
matches(ResourcePattern pattern)
boolean
matchesAtMostOne()
String
name()
PatternType
patternType()
ResourceType
resourceType()
String
toString()
-
-
-
Field Detail
-
ANY
public static final ResourcePatternFilter ANY
Matches any resource pattern.
-
-
Constructor Detail
-
ResourcePatternFilter
public ResourcePatternFilter(ResourceType resourceType, 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:
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.
-
-