public class Token extends Object implements Cloneable, Serializable
| 限定符和类型 | 方法和说明 |
|---|---|
Token |
append(String segmentType,
String value)
Construct a new
Token by appending a new TokenFormat.Segment, based
on the supplied segmentType and value, to the end of this
Token. |
Token |
append(TokenFormat.Segment segment)
|
protected Object |
clone() |
boolean |
equals(Object o) |
TokenFormat.Segment |
getLastSegment()
Get the last
TokenFormat.Segment of this Token. |
List<TokenFormat.Segment> |
getSegments()
Get the immutable list of segments that make up this
Token. |
int |
hashCode() |
boolean |
hasPrefix(Token potentialPrefix)
Determine if the supplied
Token is a prefix for this
Token. |
static Token |
parse(String token)
Parse a
Token from the supplied string representation using the default format. |
Token |
removeLastSegment()
|
static Token |
root(String segmentType,
String value)
Create a root Token from the supplied
segmentType and
value using the default format. |
String |
toString()
Generate the unique, formatted string representation of this
Token
using the configured TokenFormat. |
public static Token parse(String token) throws TokenParseException
Token from the supplied string representation using the default format.token - the string representation to parse; never null or blankTokenTokenParseException - if the string cannot be parsedpublic static Token root(String segmentType, String value)
segmentType and
value using the default format.segmentType - the segment type; never null or blankvalue - the value; never null or blankpublic final List<TokenFormat.Segment> getSegments()
Token.public final Token append(String segmentType, String value)
Token by appending a new TokenFormat.Segment, based
on the supplied segmentType and value, to the end of this
Token.
This Token will not be modified.
Neither the segmentType nor the value may contain any
of the special characters used for constructing the string representation
of this Token.
segmentType - the type of the segment; never null or blankvalue - the value of the segment; never null or blankpublic final Token append(TokenFormat.Segment segment)
Token by appending a new TokenFormat.Segment to
the end of this Token.
This Token will not be modified.
segment - the segment to be appended; never nullpublic boolean hasPrefix(Token potentialPrefix)
Token is a prefix for this
Token.potentialPrefix - the Token to be checked; never nullpublic Token removeLastSegment()
Token and removing the last TokenFormat.Segment of
this Token.
This Token will not be modified.
Token; never nullpublic TokenFormat.Segment getLastSegment()
TokenFormat.Segment of this Token.Segment; never nullprotected Object clone() throws CloneNotSupportedException
clone 在类中 ObjectCloneNotSupportedExceptionpublic String toString()
Token
using the configured TokenFormat.Copyright © 2021. All rights reserved.