public class KeySegment extends Object implements IdentifierSegment
Such a segment appears in an identifier with each component prefixed
with "&". For example, in the identifier
"[Customer].[State].&[WA]&[USA]
", the third segment is
a compound key whose parts are "WA
" and "USA
".
NameSegment
Constructor and Description |
---|
KeySegment(List<NameSegment> subSegmentList)
Creates a KeySegment a list of sub-segments.
|
KeySegment(NameSegment... subSegments)
Creates a KeySegment with one or more sub-segments.
|
Modifier and Type | Method and Description |
---|---|
List<NameSegment> |
getKeyParts()
Returns the key components, if this IdentifierSegment is a key.
|
String |
getName()
Returns the name of this IdentifierSegment.
|
Quoting |
getQuoting()
Returns how this Segment is quoted.
|
ParseRegion |
getRegion()
Returns the region of the source code which this Segment was created
from, if it was created by parsing.
|
String |
toString()
Returns a string representation of this Segment.
|
void |
toString(StringBuilder buf)
Appends a string representation of this Segment to a StringBuffer.
|
public KeySegment(NameSegment... subSegments)
subSegments
- Array of sub-segmentspublic KeySegment(List<NameSegment> subSegmentList)
subSegmentList
- List of sub-segmentspublic String toString()
IdentifierSegment
For example, "[Foo]", "&[123]", "Abc".
toString
in interface IdentifierSegment
toString
in class Object
public void toString(StringBuilder buf)
IdentifierSegment
toString
in interface IdentifierSegment
buf
- StringBufferpublic ParseRegion getRegion()
IdentifierSegment
getRegion
in interface IdentifierSegment
public Quoting getQuoting()
IdentifierSegment
getQuoting
in interface IdentifierSegment
public String getName()
IdentifierSegment
null
if this IdentifierSegment represents a key.getName
in interface IdentifierSegment
public List<NameSegment> getKeyParts()
IdentifierSegment
IdentifierSegment.getQuoting()
returns
Quoting.KEY
.)
Returns null otherwise.getKeyParts
in interface IdentifierSegment