com.tinkerpop.rexster.util
Class ElementHelper

java.lang.Object
  extended by com.tinkerpop.rexster.util.ElementHelper

public class ElementHelper
extends Object


Constructor Summary
ElementHelper()
           
 
Method Summary
static Object getTypedPropertyValue(Object propertyValue)
           
static Object getTypedPropertyValue(Object propertyValue, boolean parseTypes)
          Takes a property value string from the URI and attempts to parse it to its defined data type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementHelper

public ElementHelper()
Method Detail

getTypedPropertyValue

public static Object getTypedPropertyValue(Object propertyValue)

getTypedPropertyValue

public static Object getTypedPropertyValue(Object propertyValue,
                                           boolean parseTypes)
Takes a property value string from the URI and attempts to parse it to its defined data type. Also accepts a JSONObject or JSONArray.

The format of the property value must be enclosed with parens with two values within it separated by a comma. The first value is the data type which may be one of the following:

i or integer f or float l or long d or double s or string map list

In the event that the type is not set or the parens cannot be tracked as open and closed the parser will determine the value to simply be a string.

The value of a list must be defined with enclosing square brackets with values separated by commas. Values are defined with the same rules involving parens defined above.

The value of a map must be defined with enclosing parens where comma separated segments of new key-value pairs represent the properties of the map itself.

Values may be nested to any depth.

Parameters:
propertyValue - The value from a key-value pair. At a top level, this will come from the URI as a one of the query parameters.
parseTypes - Set to true to check strings for data type formatting.
Returns:
The property value coerced to the appropriate Java data type.


Copyright © 2009-2012. All Rights Reserved.