Package net.bytebuddy.matcher
Enum StringMatcher.Mode
- java.lang.Object
-
- java.lang.Enum<StringMatcher.Mode>
-
- net.bytebuddy.matcher.StringMatcher.Mode
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<StringMatcher.Mode>
- Enclosing class:
- StringMatcher
public static enum StringMatcher.Mode extends java.lang.Enum<StringMatcher.Mode>
Defines the mode aStringMatcher
compares to strings with.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CONTAINS
Checks if a string contains another string with respecting casing differences.CONTAINS_IGNORE_CASE
Checks if a string contains another string without respecting casing differences.ENDS_WITH
Checks if a string ends with a second string with respecting casing differences.ENDS_WITH_IGNORE_CASE
Checks if a string ends with a second string without respecting casing differences.EQUALS_FULLY
Checks if two strings equal and respects casing differences.EQUALS_FULLY_IGNORE_CASE
Checks if two strings equal without respecting casing differences.MATCHES
Checks if a string can be matched by a regular expression.STARTS_WITH
Checks if a string starts with the a second string with respecting casing differences.STARTS_WITH_IGNORE_CASE
Checks if a string starts with a second string without respecting casing differences.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
description
A description of the string for providing meaningfulObject.toString()
implementations for method matchers that rely on a match mode.
-
Constructor Summary
Constructors Modifier Constructor Description private
Mode(java.lang.String description)
Creates a new match mode.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getDescription()
Returns the description of this match mode.protected abstract boolean
matches(java.lang.String expected, java.lang.String actual)
Matches a string against another string.static StringMatcher.Mode
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static StringMatcher.Mode[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
EQUALS_FULLY
public static final StringMatcher.Mode EQUALS_FULLY
Checks if two strings equal and respects casing differences.
-
EQUALS_FULLY_IGNORE_CASE
public static final StringMatcher.Mode EQUALS_FULLY_IGNORE_CASE
Checks if two strings equal without respecting casing differences.
-
STARTS_WITH
public static final StringMatcher.Mode STARTS_WITH
Checks if a string starts with the a second string with respecting casing differences.
-
STARTS_WITH_IGNORE_CASE
public static final StringMatcher.Mode STARTS_WITH_IGNORE_CASE
Checks if a string starts with a second string without respecting casing differences.
-
ENDS_WITH
public static final StringMatcher.Mode ENDS_WITH
Checks if a string ends with a second string with respecting casing differences.
-
ENDS_WITH_IGNORE_CASE
public static final StringMatcher.Mode ENDS_WITH_IGNORE_CASE
Checks if a string ends with a second string without respecting casing differences.
-
CONTAINS
public static final StringMatcher.Mode CONTAINS
Checks if a string contains another string with respecting casing differences.
-
CONTAINS_IGNORE_CASE
public static final StringMatcher.Mode CONTAINS_IGNORE_CASE
Checks if a string contains another string without respecting casing differences.
-
MATCHES
public static final StringMatcher.Mode MATCHES
Checks if a string can be matched by a regular expression.
-
-
Method Detail
-
values
public static StringMatcher.Mode[] 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 (StringMatcher.Mode c : StringMatcher.Mode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static StringMatcher.Mode valueOf(java.lang.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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getDescription
protected java.lang.String getDescription()
Returns the description of this match mode.- Returns:
- The description of this match mode.
-
matches
protected abstract boolean matches(java.lang.String expected, java.lang.String actual)
Matches a string against another string.- Parameters:
expected
- The target of the comparison against which theactual
string is compared.actual
- The source which is subject of the comparison to theexpected
value.- Returns:
true
if the source matches the target.
-
-