All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.goodow.realtime.json.JsonObject Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2013 Goodow.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.goodow.realtime.json;

/**
 * Represents a Json object.
 */
public interface JsonObject extends JsonElement {
  /**
   * Removes all entries.
   */
  @Override
  @SuppressWarnings("unchecked")
  JsonObject clear();

  @SuppressWarnings("unchecked")
  @Override
  JsonObject copy();

  /**
   * Return the element (uncoerced) as a value.
   */
   T get(String key);

  /**
   * Return the element (uncoerced) as a JsonArray. If the type is not an array, this can result in
   * runtime errors.
   */
  JsonArray getArray(String key);

  /**
   * Return the element (uncoerced) as a boolean. If the type is not a boolean, this can result in
   * runtime errors.
   */
  boolean getBoolean(String key);

  /**
   * Return the element (uncoerced) as a number. If the type is not a number, this can result in
   * runtime errors.
   */
  double getNumber(String key);

  /**
   * Return the element (uncoerced) as a JsonObject If the type is not an object,, this can result
   * in runtime errors.
   */
  JsonObject getObject(String key);

  /**
   * Return the element (uncoerced) as a String. If the type is not a String, this can result in
   * runtime errors.
   */
  String getString(String key);

  /**
   * Returns an enumeration representing the fundamental JSON type.
   */
  JsonType getType(String key);

  /**
   * Test whether a given key has present.
   */
  boolean has(String key);

  /**
   * All keys of the object.
   */
  String[] keys();

  /**
   * Remove a given key and associated value from the object.
   * 
   * @param key
   */
  JsonObject remove(String key);

  /**
   * Set a given key to the given boolean value.
   */
  JsonObject set(String key, boolean bool_);

  /**
   * Set a given key to the given double value.
   */
  JsonObject set(String key, double number);

  /**
   * Set a given key to the given value.
   */
  JsonObject set(String key, Object value);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy