com.linkedin.restli.internal.common
Class PathSegment

java.lang.Object
  extended by com.linkedin.restli.internal.common.PathSegment

public class PathSegment
extends java.lang.Object

Name[index] representation of a path segment of a dot-delimited path referencing an entry in a complex data object.


Nested Class Summary
static class PathSegment.PathSegmentSyntaxException
           
 
Field Summary
static AsciiHexEncoding CODEC
           
static java.lang.String PATH_SEPARATOR
           
 
Method Summary
 java.lang.Integer getIndex()
           
 java.lang.String getName()
           
 com.linkedin.restli.internal.common.PathSegment.MapMap getNextLevelMap(com.linkedin.restli.internal.common.PathSegment.MapMap map)
          Get the value referenced by this path segment in the provided DataMap The method assumes the current key is not a leaf segment of the key path, i.e.
static PathSegment parse(java.lang.String string)
          Parse a (possibly) indexed path segment out of a string.
 void putOnDataMap(com.linkedin.restli.internal.common.PathSegment.MapMap map, java.lang.String value)
          Stores this object in the provided Map.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PATH_SEPARATOR

public static final java.lang.String PATH_SEPARATOR
See Also:
Constant Field Values

CODEC

public static final AsciiHexEncoding CODEC
Method Detail

parse

public static PathSegment parse(java.lang.String string)
                         throws PathSegment.PathSegmentSyntaxException
Parse a (possibly) indexed path segment out of a string. Make sure no path delimiters appear in the string, as this would not be an individual path segment. Input string may not contains '.' char or spaces.

Parameters:
string - a string to parse.
Returns:
an PathSegment object.
Throws:
PathSegment.PathSegmentSyntaxException - if invalid index value or key segment delimiter appears in the input string.

getName

public java.lang.String getName()
Returns:
the name

getIndex

public java.lang.Integer getIndex()
Returns:
the index

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

putOnDataMap

public void putOnDataMap(com.linkedin.restli.internal.common.PathSegment.MapMap map,
                         java.lang.String value)
                  throws PathSegment.PathSegmentSyntaxException
Stores this object in the provided Map. In case of an indexed key use _name to get a corresponding List, and _index for the element in the list. In case of a simple key just put the value at the name key No overrides are allowed.

Parameters:
map - the map to store the value in
value - the value to put in the map
Throws:
PathSegment.PathSegmentSyntaxException - if the object is unable to be placed

getNextLevelMap

public com.linkedin.restli.internal.common.PathSegment.MapMap getNextLevelMap(com.linkedin.restli.internal.common.PathSegment.MapMap map)
                                                                       throws PathSegment.PathSegmentSyntaxException
Get the value referenced by this path segment in the provided DataMap The method assumes the current key is not a leaf segment of the key path, i.e. it always references a Map value in the current Map.

Parameters:
map - the Map
Returns:
a Map of Strings to Maps
Throws:
PathSegment.PathSegmentSyntaxException - if the current key is a leaf segment