org.sonar.wsclient.services
Class WSUtils
java.lang.Object
org.sonar.wsclient.services.WSUtils
- Direct Known Subclasses:
- JdkUtils
public abstract class WSUtils
- extends Object
Compatibility layer between GWT and plain Java.
Well, this is bad, because code is not type-safe, so all unmarshallers also,
but this allows to remove duplications between sonar-gwt-api and sonar-ws-client.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WSUtils
public WSUtils()
setInstance
public static void setInstance(WSUtils utils)
getINSTANCE
public static WSUtils getINSTANCE()
format
public abstract String format(Date date,
String format)
encodeUrl
public abstract String encodeUrl(String url)
getField
@CheckForNull
public abstract Object getField(Object json,
String field)
- Returns:
- value of specified field from specified JSON object,
or
null
if field does not exist
getString
@CheckForNull
public abstract String getString(Object json,
String field)
- Returns:
- value of a string field from specified JSON object,
or string representation of a numeric field,
or
null
if field does not exist
getBoolean
@CheckForNull
public abstract Boolean getBoolean(Object json,
String field)
- Returns:
- Boolean value of specified field from specified JSON object,
or
null
if field does not exist
getInteger
@CheckForNull
public abstract Integer getInteger(Object json,
String field)
- Returns:
- Integer value of specified field from specified JSON object,
or
null
if field does not exist
getDouble
@CheckForNull
public abstract Double getDouble(Object json,
String field)
- Returns:
- Double value of specified field from specified JSON object,
or
null
if field does not exist
getLong
@CheckForNull
public abstract Long getLong(Object json,
String field)
- Returns:
- Long value of specified field from specified JSON object,
or
null
if field does not exist
getDateTime
@CheckForNull
public abstract Date getDateTime(Object json,
String field)
- Returns:
- Date value of specified field from specified JSON object,
or
null
if field does not exist
getArraySize
public abstract int getArraySize(Object array)
- Returns:
- size of specified JSON array
getArrayElement
public abstract Object getArrayElement(Object array,
int i)
- Returns:
- element from specified JSON array
parse
public abstract Object parse(String jsonStr)
- Returns:
- JSON object
getFields
public abstract Set<String> getFields(Object json)
- Returns:
- field names in specified JSON object
Copyright © 2009–2016 SonarSource. All rights reserved.