1 16 package com.google.gwt.json.client; 17 18 import com.google.gwt.core.client.JavaScriptObject; 19 20 23 public class JSONString extends JSONValue { 24 25 static JavaScriptObject escapeTable = initEscapeTable(); 26 27 static native String escapeChar(String c) ; 31 32 private static native JavaScriptObject initEscapeTable() ; 44 45 private String value; 46 47 53 public JSONString(String value) { 54 if (value == null) { 55 throw new NullPointerException (); 56 } 57 this.value = value; 58 } 59 60 63 public JSONString isString() { 64 return this; 65 } 66 67 70 public String stringValue() { 71 return value; 72 } 73 74 78 public String toString() { 79 return escapeValue(value); 80 } 81 82 private native String escapeValue(String toEscape) ; 88 } 89 | Popular Tags |