Class SmithyPattern.Segment
java.lang.Object
software.amazon.smithy.model.pattern.SmithyPattern.Segment
- Enclosing class:
 - SmithyPattern
 
Segment within a SmithyPattern.
- 
Nested Class Summary
Nested Classes - 
Constructor Summary
ConstructorsConstructorDescriptionSegment(String content, SmithyPattern.Segment.Type segmentType) Segment(String content, SmithyPattern.Segment.Type segmentType, Integer offset)  - 
Method Summary
Modifier and TypeMethodDescriptionbooleanGet the content of the segment.inthashCode()booleanbooleanisLabel()booleanbooleanstatic SmithyPattern.SegmentParse a segment from the given offset.toString()Get the segment as a literal value to be used in a pattern. 
- 
Constructor Details
- 
Segment
 - 
Segment
 
 - 
 - 
Method Details
- 
parse
Parse a segment from the given offset.- Parameters:
 content- Content of the segment.offset- Character offset where the segment starts in the containing pattern.- Returns:
 - Returns the created segment.
 - Throws:
 InvalidPatternException- if the segment is invalid.
 - 
getContent
Get the content of the segment.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".
- Returns:
 - Content of the segment.
 
 - 
isLiteral
public boolean isLiteral()- Returns:
 - True if the segment is a non-label literal.
 
 - 
isLabel
public boolean isLabel()- Returns:
 - True if the segment is a label regardless of whether is greedy or not.
 
 - 
isNonGreedyLabel
public boolean isNonGreedyLabel()- Returns:
 - True if the segment is a non-greedy label.
 
 - 
isGreedyLabel
public boolean isGreedyLabel()- Returns:
 - True if the segment is a greedy label.
 
 - 
toString
Get the segment as a literal value to be used in a pattern.Unlike the result of
getContent(), the return value oftoStringincludes braces for labels and "+" for greedy labels. - 
equals
 - 
hashCode
public int hashCode() 
 -