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 match
ResourcePattern
.
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
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 Details
-
ANY
Matches any resource pattern.
-
-
Constructor Details
-
ResourcePatternFilter
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 Details
-
isUnknown
public boolean isUnknown()- Returns:
true
if this filter has any UNKNOWN components.
-
resourceType
- Returns:
- the specific resource type this pattern matches
-
name
- Returns:
- the resource name.
-
patternType
- Returns:
- the resource pattern type.
-
matches
- 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
- Returns:
- a string describing any ANY or UNKNOWN field, or null if there is no such field.
-
toString
-
equals
-
hashCode
public int hashCode()
-