Package com.google.gwt.json.client

Examples of com.google.gwt.json.client.JSONString


  protected String getString(int index) {
    JSONValue value = get(index);
    if (value == null) {
      return null;
    }
    JSONString str = value.isString();
    return str == null ? null : str.stringValue();
  }
View Full Code Here


  }

  protected void put(String key, String value) {
    JSONValue val = JSONNull.getInstance();
    if (value != null) {
      val = new JSONString(value);
    }
    m_jsonObj.put(key, val);
  }
View Full Code Here

  protected String getString(String key) {
    JSONValue value = get(key);
    if (value == null) {
      return null;
    }
    JSONString str = value.isString();
    return str == null ? null : str.stringValue();
  }
View Full Code Here

  
  
   private String getErrorMessage(ServerError error)
   {
      String message = error.getUserMessage();
      JSONString userMessage = error.getClientInfo().isString();
      if (userMessage != null)
         message = userMessage.stringValue();
      return message;
   }
View Full Code Here

      listBox_.addChangeHandler(new ChangeHandler(){
         @Override
         public void onChange(ChangeEvent event)
         {
            ManipulatorControlPicker.this.onValueChanged(
             new JSONString(listBox_.getItemText(listBox_.getSelectedIndex())));
         }  
      });
      panel.add(listBox_);
     
      initWidget(panel);
View Full Code Here

                 
                  // see if a special message was provided
                  JSONValue errValue = error.getClientInfo();
                  if (errValue != null)
                  {
                     JSONString errMsg = errValue.isString();
                     if (errMsg != null)
                        message = errMsg.stringValue();
                  }
                 
                  globalDisplay_.showMessage(GlobalDisplay.MSG_ERROR,
                                             "Error while opening file",
                                             message);
View Full Code Here

            break;

         if (array.size() == 0)
            break;

         JSONString string = array.get(0).isString();
         if (string == null)
            break;

         values.add(string.stringValue());
      }
      return values;
   }
View Full Code Here

            // Character isn't a java.lang.Number
            || value instanceof Character

            // Timestamp includes nanoseconds, and has a special String representation that is parseable
            || value instanceof Timestamp) {
      return new JSONString(value.toString());
    }
    else if (value instanceof Boolean) {
      return JSONBoolean.getInstance((Boolean) value);
    }
    else if (value instanceof Number) {
      return new JSONNumber(((Number) value).doubleValue());
    }
    else if (value instanceof Enum) {
      return new JSONString(((Enum<?>) value).name());
    }
    else if (value instanceof Date) {  // covers java.sql.[Date,Time,Timestamp]
      return new JSONString(String.valueOf(((Date) value).getTime()));
    }
    else if (value instanceof byte[]) {
      byte[] v = (byte[]) value;
      return new JSONString(Base64Util.encode(v, 0, v.length));
    }
    else if (value instanceof Byte[]) {
      Byte[] v = (Byte[]) value;
      return new JSONString(Base64Util.encode(v, 0, v.length));
    }
    else if (value instanceof char[]) {
      return new JSONString(String.copyValueOf(((char[]) value)));
    }
    else if (value instanceof Character[]) {
      Character[] v = (Character[]) value;
      StringBuilder sb = new StringBuilder(v.length);
      for (Character c : v) {
        sb.append((char) c);
      }
      return new JSONString(sb.toString());
    }
    else {
      throw new RuntimeException("I don't know how JSONify " + value + " (" + value.getClass() + ")");
    }
  }
View Full Code Here

        }
      }
      return true;
    }
    else if (v1.isString() != null) {
      JSONString s1 = v1.isString();
      JSONString s2 = v2.isString();
      return s1.stringValue().equals(s2.stringValue());
    }
    else {
      throw new AssertionError("Found unexpected subtype of JSONValue: " + v1.getClass());
    }
    // NOTREACHED
View Full Code Here

                // this issue still needs more research
                Log.debug("Failed to strip out HTML.  This should be preferred?");
            }
            try {
                JSONObject response = JSONParser.parseLenient(json).isObject();
                JSONString outcome = response.get("outcome").isString();
                if (outcome != null && "success".equalsIgnoreCase(outcome.stringValue())) {
                    patchManager.getPatches(new SimpleCallback<Patches>() {
                        @Override
                        public void onSuccess(final Patches result) {
                            context.patchInfo = result.getLatest();
                            wizard.next();
View Full Code Here

TOP

Related Classes of com.google.gwt.json.client.JSONString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.