Top Description Inners Fields Constructors Methods
net.bytebuddy.matcher

public Class StringMatcher

extends ElementMatcher.Junction.ForNonNullValues<String>
Class Inheritance
Annotations
@Enhance
Imports
edu.umd.cs.findbugs.annotations.SuppressFBWarnings, net.bytebuddy.build.HashCodeAndEqualsPlugin

An element matcher that compares two strings by a given pattern which is characterized by a net.bytebuddy.matcher.StringMatcher.Mode.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
StringMatcher.Mode

Defines the mode a net.bytebuddy.matcher.StringMatcher compares to strings with.

Field Summary

Modifier and TypeField and Description
private final StringMatcher.Mode
mode

The mode to apply for matching the given value against the matcher's input.

private final String
value

The text value to match against.

Constructor Summary

AccessConstructor and Description
public
StringMatcher(String
The value that is the base of the matching.
value
,
StringMatcher.Mode
The mode to apply for matching the given value against the matcher's input
mode
)

Creates a new string matcher.

Method Summary

Modifier and TypeMethod and Description
protected boolean
doMatch(String
The instance to be matched.
target
)

Implements abstract net.bytebuddy.matcher.ElementMatcher.Junction.ForNonNullValues.doMatch.

Matches the supplied value if it was found not to be null.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from net.bytebuddy.matcher.ElementMatcher.Junction.ForNonNullValues:
matches

Field Detail

modeback to summary
private final StringMatcher.Mode mode

The mode to apply for matching the given value against the matcher's input.

valueback to summary
private final String value

The text value to match against.

Constructor Detail

StringMatcherback to summary
public StringMatcher(String value, StringMatcher.Mode mode)

Creates a new string matcher.

Parameters
value:String

The value that is the base of the matching.

mode:StringMatcher.Mode

The mode to apply for matching the given value against the matcher's input

Method Detail

doMatchback to summary
protected boolean doMatch(String target)

Implements abstract net.bytebuddy.matcher.ElementMatcher.Junction.ForNonNullValues.doMatch.

Doc from net.bytebuddy.matcher.ElementMatcher.Junction.ForNonNullValues.doMatch.

Matches the supplied value if it was found not to be null.

Parameters
target:String

The instance to be matched.

Returns:boolean

true if the given element is matched by this matcher or false otherwise.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
net.bytebuddy.matcher back to summary

public sealed Enum StringMatcher.Mode

extends Enum<StringMatcher.Mode>
Class Inheritance

Defines the mode a net.bytebuddy.matcher.StringMatcher compares to strings with.

Field Summary

Modifier and TypeField and Description
public static final StringMatcher.Mode
CONTAINS

Checks if a string contains another string with respecting casing differences.

public static final StringMatcher.Mode
CONTAINS_IGNORE_CASE

Checks if a string contains another string without respecting casing differences.

private final String
description

A description of the string for providing meaningful Object#toString() implementations for method matchers that rely on a match mode.

public static final StringMatcher.Mode
ENDS_WITH

Checks if a string ends with a second string with respecting casing differences.

public static final StringMatcher.Mode
ENDS_WITH_IGNORE_CASE

Checks if a string ends with a second string without respecting casing differences.

public static final StringMatcher.Mode
EQUALS_FULLY

Checks if two strings equal and respects casing differences.

public static final StringMatcher.Mode
EQUALS_FULLY_IGNORE_CASE

Checks if two strings equal without respecting casing differences.

public static final StringMatcher.Mode
MATCHES

Checks if a string can be matched by a regular expression.

public static final StringMatcher.Mode
STARTS_WITH

Checks if a string starts with the a second string with respecting casing differences.

public static final StringMatcher.Mode
STARTS_WITH_IGNORE_CASE

Checks if a string starts with a second string without respecting casing differences.

Constructor Summary

AccessConstructor and Description
private
Mode(String
The description of this mode for providing meaningful Object#toString() implementations.
description
)

Creates a new match mode.

Method Summary

Modifier and TypeMethod and Description
protected String

Returns:

The description of this match mode.
getDescription
()

Returns the description of this match mode.

protected abstract boolean

Returns:

true if the source matches the target.
matches
(String
The target of the comparison against which the actual string is compared.
expected
,
String
The source which is subject of the comparison to the expected value.
actual
)

Matches a string against another string.

public static StringMatcher.Mode
public static StringMatcher.Mode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CONTAINSback to summary
public static final StringMatcher.Mode CONTAINS

Checks if a string contains another string with respecting casing differences.

CONTAINS_IGNORE_CASEback to summary
public static final StringMatcher.Mode CONTAINS_IGNORE_CASE

Checks if a string contains another string without respecting casing differences.

descriptionback to summary
private final String description

A description of the string for providing meaningful Object#toString() implementations for method matchers that rely on a match mode.

ENDS_WITHback to summary
public static final StringMatcher.Mode ENDS_WITH

Checks if a string ends with a second string with respecting casing differences.

ENDS_WITH_IGNORE_CASEback to summary
public static final StringMatcher.Mode ENDS_WITH_IGNORE_CASE

Checks if a string ends with a second string without respecting casing differences.

EQUALS_FULLYback to summary
public static final StringMatcher.Mode EQUALS_FULLY

Checks if two strings equal and respects casing differences.

EQUALS_FULLY_IGNORE_CASEback to summary
public static final StringMatcher.Mode EQUALS_FULLY_IGNORE_CASE

Checks if two strings equal without respecting casing differences.

MATCHESback to summary
public static final StringMatcher.Mode MATCHES

Checks if a string can be matched by a regular expression.

STARTS_WITHback to summary
public static final StringMatcher.Mode STARTS_WITH

Checks if a string starts with the a second string with respecting casing differences.

STARTS_WITH_IGNORE_CASEback to summary
public static final StringMatcher.Mode STARTS_WITH_IGNORE_CASE

Checks if a string starts with a second string without respecting casing differences.

Constructor Detail

Modeback to summary
private Mode(String description)

Creates a new match mode.

Parameters
description:String

The description of this mode for providing meaningful Object#toString() implementations.

Method Detail

getDescriptionback to summary
protected String getDescription()

Returns the description of this match mode.

Returns:String

The description of this match mode.

matchesback to summary
protected abstract boolean matches(String expected, String actual)

Matches a string against another string.

Parameters
expected:String

The target of the comparison against which the actual string is compared.

actual:String

The source which is subject of the comparison to the expected value.

Returns:boolean

true if the source matches the target.

valueOfback to summary
public static StringMatcher.Mode valueOf(String name)
valuesback to summary
public static StringMatcher.Mode[] values()