public final class ImmutableMatchPattern extends Object implements MatchPattern
MatchPattern.
Use the builder to create immutable instances:
ImmutableMatchPattern.builder().
Use the static factory method to create immutable instances:
ImmutableMatchPattern.of().
| Modifier and Type | Class and Description |
|---|---|
static class |
ImmutableMatchPattern.Builder
Builds instances of type
ImmutableMatchPattern. |
| Modifier and Type | Method and Description |
|---|---|
static ImmutableMatchPattern.Builder |
builder()
Creates a builder for
ImmutableMatchPattern. |
static ImmutableMatchPattern |
copyOf(MatchPattern instance)
Creates an immutable copy of a
MatchPattern value. |
boolean |
equals(Object another)
This instance is equal to all instances of
ImmutableMatchPattern that have equal attribute values. |
int |
hashCode()
Computes a hash code from attributes:
pattern. |
static ImmutableMatchPattern |
of(Pattern pattern)
Construct a new immutable
MatchPattern instance. |
Pattern |
pattern() |
String |
toString()
Prints the immutable value
MatchPattern with attribute values. |
ImmutableMatchPattern |
withPattern(Pattern value)
Copy the current immutable object by setting a value for the
pattern attribute. |
public Pattern pattern()
pattern in interface MatchPatternpattern attributepublic final ImmutableMatchPattern withPattern(Pattern value)
pattern attribute.
A shallow reference equality check is used to prevent copying of the same value by returning this.value - A new value for patternthis objectpublic boolean equals(Object another)
ImmutableMatchPattern that have equal attribute values.public int hashCode()
pattern.public String toString()
MatchPattern with attribute values.public static ImmutableMatchPattern of(Pattern pattern)
MatchPattern instance.pattern - The value for the pattern attributepublic static ImmutableMatchPattern copyOf(MatchPattern instance)
MatchPattern value.
Uses accessors to get values to initialize the new immutable instance.
If an instance is already immutable, it is returned as is.instance - The instance to copypublic static ImmutableMatchPattern.Builder builder()
ImmutableMatchPattern.
ImmutableMatchPattern.builder()
.pattern(regex.Pattern) // required pattern
.build();
Copyright © 2022. All rights reserved.