Package org.apache.kafka.common.resource
Enum PatternType
- java.lang.Object
-
- java.lang.Enum<PatternType>
-
- org.apache.kafka.common.resource.PatternType
-
- All Implemented Interfaces:
Serializable
,Comparable<PatternType>
@Evolving public enum PatternType extends Enum<PatternType>
Resource pattern type.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ANY
In a filter, matches any resource pattern type.LITERAL
A literal resource name.MATCH
In a filter, will perform pattern matching.PREFIXED
A prefixed resource name.UNKNOWN
Represents any PatternType which this client cannot understand, perhaps because this client is too old.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte
code()
static PatternType
fromCode(byte code)
Return the PatternType with the provided code orUNKNOWN
if one cannot be found.static PatternType
fromString(String name)
Return the PatternType with the provided name orUNKNOWN
if one cannot be found.boolean
isSpecific()
boolean
isUnknown()
static PatternType
valueOf(String name)
Returns the enum constant of this type with the specified name.static PatternType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
UNKNOWN
public static final PatternType UNKNOWN
Represents any PatternType which this client cannot understand, perhaps because this client is too old.
-
ANY
public static final PatternType ANY
In a filter, matches any resource pattern type.
-
MATCH
public static final PatternType MATCH
In a filter, will perform pattern matching. e.g. Given a filter ofResourcePatternFilter(TOPIC, "payments.received", MATCH)`
, the filter match anyResourcePattern
that matches topic 'payments.received'. This might include:- A Literal pattern with the same type and name, e.g.
ResourcePattern(TOPIC, "payments.received", LITERAL)
- A Wildcard pattern with the same type, e.g.
ResourcePattern(TOPIC, "*", LITERAL)
- A Prefixed pattern with the same type and where the name is a matching prefix, e.g.
ResourcePattern(TOPIC, "payments.", PREFIXED)
- A Literal pattern with the same type and name, e.g.
-
LITERAL
public static final PatternType LITERAL
A literal resource name. A literal name defines the full name of a resource, e.g. topic with name 'foo', or group with name 'bob'. The special wildcard character*
can be used to represent a resource with any name.
-
PREFIXED
public static final PatternType PREFIXED
A prefixed resource name. A prefixed name defines a prefix for a resource, e.g. topics with names that start with 'foo'.
-
-
Method Detail
-
values
public static PatternType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PatternType c : PatternType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PatternType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
code
public byte code()
- Returns:
- the code of this resource.
-
isUnknown
public boolean isUnknown()
- Returns:
- whether this resource pattern type is UNKNOWN.
-
isSpecific
public boolean isSpecific()
- Returns:
- whether this resource pattern type is a concrete type, rather than UNKNOWN or one of the filter types.
-
fromCode
public static PatternType fromCode(byte code)
Return the PatternType with the provided code orUNKNOWN
if one cannot be found.
-
fromString
public static PatternType fromString(String name)
Return the PatternType with the provided name orUNKNOWN
if one cannot be found.
-
-