Class KeySegment

  • All Implemented Interfaces:
    IdentifierSegment

    public class KeySegment
    extends java.lang.Object
    implements IdentifierSegment
    Segment that represents a key or compound key.

    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".

    Author:
    jhyde
    See Also:
    NameSegment
    • Constructor Summary

      Constructors 
      Constructor Description
      KeySegment​(java.util.List<NameSegment> subSegmentList)
      Creates a KeySegment a list of sub-segments.
      KeySegment​(NameSegment... subSegments)
      Creates a KeySegment with one or more sub-segments.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<NameSegment> getKeyParts()
      Returns the key components, if this IdentifierSegment is a key.
      java.lang.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.
      java.lang.String toString()
      Returns a string representation of this Segment.
      void toString​(java.lang.StringBuilder buf)
      Appends a string representation of this Segment to a StringBuffer.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • KeySegment

        public KeySegment​(NameSegment... subSegments)
        Creates a KeySegment with one or more sub-segments.
        Parameters:
        subSegments - Array of sub-segments
      • KeySegment

        public KeySegment​(java.util.List<NameSegment> subSegmentList)
        Creates a KeySegment a list of sub-segments.
        Parameters:
        subSegmentList - List of sub-segments
    • Method Detail

      • toString

        public java.lang.String toString()
        Description copied from interface: IdentifierSegment
        Returns a string representation of this Segment.

        For example, "[Foo]", "&[123]", "Abc".

        Specified by:
        toString in interface IdentifierSegment
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representation of this Segment
      • toString

        public void toString​(java.lang.StringBuilder buf)
        Description copied from interface: IdentifierSegment
        Appends a string representation of this Segment to a StringBuffer.
        Specified by:
        toString in interface IdentifierSegment
        Parameters:
        buf - StringBuffer
      • getRegion

        public ParseRegion getRegion()
        Description copied from interface: IdentifierSegment
        Returns the region of the source code which this Segment was created from, if it was created by parsing.
        Specified by:
        getRegion in interface IdentifierSegment
        Returns:
        region of source code
      • getName

        public java.lang.String getName()
        Description copied from interface: IdentifierSegment
        Returns the name of this IdentifierSegment. Returns null if this IdentifierSegment represents a key.
        Specified by:
        getName in interface IdentifierSegment
        Returns:
        name of this Segment