public class SmithyPattern
extends java.lang.Object
A pattern is a series of segments, some of which may be labels.
Labels may appear in the pattern in the form of "{label}". Labels must not be repeated, must not contain other labels (e.g., "{fo{bar}oo}"), and the label name must match the regex "^[a-zA-Z0-9_]+$". No labels can appear after the query string.
Greedy labels, a specialized type of label, may be specified using "{label+}". Only a single greedy label may appear in a pattern, and it must be the last label in a pattern. Greedy labels may be disabled for a pattern as part of the builder construction.
Modifier and Type | Class and Description |
---|---|
static class |
SmithyPattern.Builder
Builder used to create a SmithyPattern.
|
static class |
SmithyPattern.Segment
Segment within a SmithyPattern.
|
Modifier | Constructor and Description |
---|---|
protected |
SmithyPattern(SmithyPattern.Builder builder) |
Modifier and Type | Method and Description |
---|---|
static SmithyPattern.Builder |
builder() |
boolean |
equals(java.lang.Object other) |
java.util.Map<SmithyPattern.Segment,SmithyPattern.Segment> |
getConflictingLabelSegmentsMap(SmithyPattern otherPattern)
Gets a map of explicitly conflicting label segments between this
pattern and another.
|
java.util.Optional<SmithyPattern.Segment> |
getGreedyLabel()
Gets the greedy label of the pattern, if present.
|
java.util.Optional<SmithyPattern.Segment> |
getLabel(java.lang.String name)
Get a label by case-insensitive name.
|
java.util.List<SmithyPattern.Segment> |
getLabels()
Get a list of all segments that are labels.
|
java.util.List<SmithyPattern.Segment> |
getSegments()
Gets all segments, in order.
|
int |
hashCode() |
java.lang.String |
toString() |
protected SmithyPattern(SmithyPattern.Builder builder)
public final java.util.List<SmithyPattern.Segment> getSegments()
public final java.util.List<SmithyPattern.Segment> getLabels()
public final java.util.Optional<SmithyPattern.Segment> getLabel(java.lang.String name)
name
- Name of the label to retrieve.public final java.util.Optional<SmithyPattern.Segment> getGreedyLabel()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public java.util.Map<SmithyPattern.Segment,SmithyPattern.Segment> getConflictingLabelSegmentsMap(SmithyPattern otherPattern)
otherPattern
- SmithyPattern to check against.public int hashCode()
hashCode
in class java.lang.Object
public static SmithyPattern.Builder builder()