org.sonar.wsclient.gwt
Class GwtUtils

java.lang.Object
  extended by org.sonar.wsclient.services.WSUtils
      extended by org.sonar.wsclient.gwt.GwtUtils

public class GwtUtils
extends WSUtils


Constructor Summary
GwtUtils()
           
 
Method Summary
 String encodeUrl(String url)
           
 String format(Date date, String format)
           
 Object getArrayElement(Object array, int i)
           
 int getArraySize(Object array)
           
 Boolean getBoolean(Object json, String field)
           
 Date getDateTime(Object json, String field)
           
 Double getDouble(Object json, String field)
           
 Object getField(Object json, String field)
           
 Set<String> getFields(Object json)
           
 Integer getInteger(Object json, String field)
           
 Long getLong(Object json, String field)
           
 String getString(Object json, String field)
           
 Object parse(String jsonStr)
           
 
Methods inherited from class org.sonar.wsclient.services.WSUtils
getINSTANCE, setInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GwtUtils

public GwtUtils()
Method Detail

format

public String format(Date date,
                     String format)
Specified by:
format in class WSUtils

encodeUrl

public String encodeUrl(String url)
Specified by:
encodeUrl in class WSUtils

getField

public Object getField(Object json,
                       String field)
Specified by:
getField in class WSUtils
Returns:
value of specified field from specified JSON object, or null if field does not exist

getString

public String getString(Object json,
                        String field)
Specified by:
getString in class WSUtils
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

public Boolean getBoolean(Object json,
                          String field)
Specified by:
getBoolean in class WSUtils
Returns:
Boolean value of specified field from specified JSON object, or null if field does not exist

getInteger

public Integer getInteger(Object json,
                          String field)
Specified by:
getInteger in class WSUtils
Returns:
Integer value of specified field from specified JSON object, or null if field does not exist

getDouble

public Double getDouble(Object json,
                        String field)
Specified by:
getDouble in class WSUtils
Returns:
Double value of specified field from specified JSON object, or null if field does not exist

getLong

public Long getLong(Object json,
                    String field)
Specified by:
getLong in class WSUtils
Returns:
Long value of specified field from specified JSON object, or null if field does not exist

getDateTime

public Date getDateTime(Object json,
                        String field)
Specified by:
getDateTime in class WSUtils
Returns:
Date value of specified field from specified JSON object, or null if field does not exist

getArraySize

public int getArraySize(Object array)
Specified by:
getArraySize in class WSUtils
Returns:
size of specified JSON array

getArrayElement

public Object getArrayElement(Object array,
                              int i)
Specified by:
getArrayElement in class WSUtils
Returns:
element from specified JSON array

parse

public Object parse(String jsonStr)
Specified by:
parse in class WSUtils
Returns:
JSON object

getFields

public Set<String> getFields(Object json)
Specified by:
getFields in class WSUtils
Returns:
field names in specified JSON object


Copyright © 2009-2011 SonarSource. All Rights Reserved.