Tabnine Logo
JsonValue.asString
Code IndexAdd Tabnine to your IDE (free)

How to use
asString
method
in
org.hjson.JsonValue

Best Java code snippets using org.hjson.JsonValue.asString (Showing top 12 results out of 315)

origin: org.hjson/hjson

/**
 * Returns the <code>String</code> value of the member with the specified name in this object. If
 * this object does not contain a member with this name, the given default value is returned. If
 * this object contains multiple members with the given name, the last one is picked. If this
 * member's value does not represent a JSON string, an exception is thrown.
 *
 * @param name
 *          the name of the member whose value is to be returned
 * @param defaultValue
 *          the value to be returned if the requested member is missing
 * @return the value of the last member with the specified name, or the given default value if
 *         this object does not contain a member with that name
 */
public String getString(String name, String defaultValue) {
 JsonValue value=get(name);
 return value!=null ? value.asString() : defaultValue;
}
origin: hjson/hjson-java

/**
 * Returns the <code>String</code> value of the member with the specified name in this object. If
 * this object does not contain a member with this name, the given default value is returned. If
 * this object contains multiple members with the given name, the last one is picked. If this
 * member's value does not represent a JSON string, an exception is thrown.
 *
 * @param name
 *          the name of the member whose value is to be returned
 * @param defaultValue
 *          the value to be returned if the requested member is missing
 * @return the value of the last member with the specified name, or the given default value if
 *         this object does not contain a member with that name
 */
public String getString(String name, String defaultValue) {
 JsonValue value=get(name);
 return value!=null ? value.asString() : defaultValue;
}
origin: Panda-Programming-Language/Panda

private boolean equals(String key, JsonObject conditions, String value) {
  return !conditions.names().contains(key) || value.equalsIgnoreCase(conditions.get(key).asString());
}
origin: TridentSDK/TridentSDK

/**
 * Parses a click event from the given JSON.
 *
 * @param json The JSON.
 * @return The click event.
 */
public static ClickEvent fromJson(JsonObject json) {
  return of(ClickAction.valueOf(json.get("action").asString().toUpperCase()), json.get("value").asString());
}
origin: TridentSDK/TridentSDK

/**
 * Parses a click event from the given JSON.
 *
 * @param json The JSON.
 * @return The click event.
 */
public static HoverEvent fromJson(JsonValue json) {
  return new HoverEvent(HoverAction.valueOf(json.asObject().get("action").asString().toUpperCase()), json.asObject().get("value"));
}
origin: org.hjson/hjson

 break;
case STRING:
 writeString(value.asString(), tw, level, separator);
 break;
default:
origin: org.hjson/hjson

case STRING:
 tw.write('"');
 tw.write(escapeString(value.asString()));
 tw.write('"');
 break;
origin: hjson/hjson-java

 break;
case STRING:
 writeString(value.asString(), tw, level, separator);
 break;
default:
origin: hjson/hjson-java

case STRING:
 tw.write('"');
 tw.write(escapeString(value.asString()));
 tw.write('"');
 break;
origin: net.akehurst.application.framework/net.akehurst.application.framework.technology.persistence.filesystem

Object convertJsonToJava(final JsonValue value) throws PersistentStoreException {
  if (null == value) {
    return null;
  } else if (value.isString()) {
    return value.asString();
  } else if (value.isNumber()) {
    return value.asDouble();
  } else if (value.isBoolean()) {
    return value.asBoolean();
  } else if (value.isArray()) {
    final List<Object> list = new ArrayList<>();
    for (final JsonValue av : value.asArray()) {
      final Object o = this.convertJsonToJava(av);
      list.add(o);
    }
    return list;
  } else if (value.isObject()) {
    final Map<String, Object> map = new HashMap<>();
    for (final String k : value.asObject().names()) {
      final JsonValue jv = value.asObject().get(k);
      final Object v = this.convertJsonToJava(jv);
      map.put(k, v);
    }
    return map;
  } else {
    throw new PersistentStoreException("Unknown JSON type.", null);
  }
}
origin: net.akehurst.application.framework/net.akehurst.application.framework.technology.persistence.filesystem

  return null;
} else if (value.isString()) {
  final T t = this.af.createDatatype(itemType, value.asString());
  return t;
} else if (value.isNumber()) {
origin: TridentSDK/TridentSDK

JsonValue text = json.get("text");
if (text != null) {
  cc.setText(text.asString());
  cc.setTranslate(translate.asString());
    JsonValue el = array.get(i);
    if (el.isString() || el.isNumber() || el.isBoolean())
      cc.addWith(el.asString());
    else if (el.isObject())
      cc.addWith(fromJson(el.asObject()));
if (score != null) {
  JsonObject scoreArray = score.asObject();
  cc.setScoreUsername(scoreArray.get("name").asString());
  cc.setScoreObjective(scoreArray.get("objective").asString());
  cc.setSelector(selector.asString());
    JsonValue el = array.get(i);
    if (el.isString() || el.isNumber() || el.isBoolean())
      cc.addExtra(el.asString());
    else if (el.isObject())
      cc.addExtra(fromJson(el.asObject()));
  cc.setColor(ChatColor.valueOf(color.asString().toUpperCase()));
  cc.setInsertion(insertion.asString());
org.hjsonJsonValueasString

Javadoc

Returns this JSON value as String, assuming that this value represents a JSON string. If this is not the case, an exception is thrown.

Popular methods of JsonValue

  • toString
    Returns the JSON/Hjson string for this value using the given formatting.
  • readHjson
    Reads a Hjson value from the given string.
  • asObject
    Returns this JSON value as JsonObject, assuming that this value represents a JSON object. If this is
  • asArray
    Returns this JSON value as JsonArray, assuming that this value represents a JSON array. If this is n
  • asBoolean
    Returns this JSON value as a boolean value, assuming that this value is either true or false. If thi
  • isNumber
    Detects whether this value represents a JSON number.
  • writeTo
    Writes the JSON/Hjson representation of this value to the given writer using the given formatting. W
  • asDouble
    Returns this JSON value as a double value, assuming that this value represents a JSON number. If thi
  • equals
    Indicates whether some other object is "equal to" this one according to the contract specified in Ob
  • hashCode
  • readJSON
    Reads a JSON value from the given string.
  • asFloat
    Returns this JSON value as a float value, assuming that this value represents a JSON number. If this
  • readJSON,
  • asFloat,
  • asInt,
  • asLong,
  • getType,
  • isBoolean,
  • isObject,
  • isPunctuatorChar,
  • isString

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • getSystemService (Context)
  • findViewById (Activity)
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now