public static final class SmithyPattern.Segment
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SmithyPattern.Segment.Type |
| Constructor and Description |
|---|
Segment(java.lang.String content,
SmithyPattern.Segment.Type segmentType) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object other) |
java.lang.String |
getContent()
Get the content of the segment.
|
int |
hashCode() |
boolean |
isGreedyLabel() |
boolean |
isLabel() |
static SmithyPattern.Segment |
parse(java.lang.String content,
int offset)
Parse a segment from the given offset.
|
java.lang.String |
toString()
Get the segment as a literal value to be used in a pattern.
|
public Segment(java.lang.String content,
SmithyPattern.Segment.Type segmentType)
public static SmithyPattern.Segment parse(java.lang.String content, int offset)
content - Content of the segment.offset - Character offset where the segment starts.InvalidPatternException - if the segment is invalid.public java.lang.String getContent()
The return value contains the segment in its entirety for non-labels, and the label name for both labels and greedy labels. For example, given a segment of "{label+}", the return value of getContent would be "label".
public boolean isLabel()
public boolean isGreedyLabel()
public java.lang.String toString()
Unlike the result of getContent(), the return value
of toString includes braces for labels and "+" for
greedy labels.
toString in class java.lang.Objectpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object