Codota Logo
JSONArray.opt
Code IndexAdd Codota to your IDE (free)

How to use
opt
method
in
org.opencms.json.JSONArray

Best Java code snippets using org.opencms.json.JSONArray.opt (Showing top 19 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: org.opencms/opencms-core

/**
 * Get the optional JSONArray associated with an index.<p>
 *
 * @param index the index must be between 0 and length() - 1
 * @return aA JSONArray value, or null if the index has no value, or if the value is not a JSONArray
 */
public JSONArray optJSONArray(int index) {
  Object o = opt(index);
  return o instanceof JSONArray ? (JSONArray)o : null;
}
origin: org.opencms/opencms-solr

/**
 * Get the optional JSONArray associated with an index.<p>
 * 
 * @param index the index must be between 0 and length() - 1
 * @return aA JSONArray value, or null if the index has no value, or if the value is not a JSONArray
 */
public JSONArray optJSONArray(int index) {
  Object o = opt(index);
  return o instanceof JSONArray ? (JSONArray)o : null;
}
origin: org.opencms/opencms-solr

/**
 * Get the optional JSONObject associated with an index.<p>
 * 
 * Null is returned if the key is not found, or null if the index has
 * no value, or if the value is not a JSONObject.<p>
 *
 * @param index the index must be between 0 and length() - 1
 * @return a JSONObject value
 */
public JSONObject optJSONObject(int index) {
  Object o = opt(index);
  return o instanceof JSONObject ? (JSONObject)o : null;
}
origin: org.opencms/opencms-core

/**
 * Get the optional JSONObject associated with an index.<p>
 *
 * Null is returned if the key is not found, or null if the index has
 * no value, or if the value is not a JSONObject.<p>
 *
 * @param index the index must be between 0 and length() - 1
 * @return a JSONObject value
 */
public JSONObject optJSONObject(int index) {
  Object o = opt(index);
  return o instanceof JSONObject ? (JSONObject)o : null;
}
origin: org.opencms/opencms-solr

/**
 * Determine if the value is null.<p>
 * 
 * @param index the index must be between 0 and length() - 1
 * @return true if the value at the index is null, or if there is no value
 */
public boolean isNull(int index) {
  return JSONObject.NULL.equals(opt(index));
}
origin: org.opencms/opencms-solr

/**
 * Get the optional string associated with an index.<p>
 * 
 * The defaultValue is returned if the key is not found.<p>
 *
 * @param index tThe index must be between 0 and length() - 1
 * @param defaultValue the default value
 * @return a String value
 */
public String optString(int index, String defaultValue) {
  Object o = opt(index);
  return o != null ? o.toString() : defaultValue;
}
origin: org.opencms/opencms-core

/**
 * Get the optional string associated with an index.<p>
 *
 * The defaultValue is returned if the key is not found.<p>
 *
 * @param index tThe index must be between 0 and length() - 1
 * @param defaultValue the default value
 * @return a String value
 */
public String optString(int index, String defaultValue) {
  Object o = opt(index);
  return o != null ? o.toString() : defaultValue;
}
origin: org.opencms/opencms-core

/**
 * Determine if the value is null.<p>
 *
 * @param index the index must be between 0 and length() - 1
 * @return true if the value at the index is null, or if there is no value
 */
public boolean isNull(int index) {
  return JSONObject.NULL.equals(opt(index));
}
origin: org.opencms/opencms-core

/**
 * Get the object value associated with an index.<p>
 *
 * @param index the index must be between 0 and length() - 1
 * @return an object value
 * @throws JSONException if there is no value for the index
 */
public Object get(int index) throws JSONException {
  Object o = opt(index);
  if (o == null) {
    throw new JSONException("JSONArray[" + index + "] not found.");
  }
  return o;
}
origin: org.opencms/opencms-solr

/**
 * Get the object value associated with an index.<p>
 * 
 * @param index the index must be between 0 and length() - 1
 * @return an object value
 * @throws JSONException if there is no value for the index
 */
public Object get(int index) throws JSONException {
  Object o = opt(index);
  if (o == null) {
    throw new JSONException("JSONArray[" + index + "] not found.");
  }
  return o;
}
origin: org.opencms/opencms-solr

  sb.append(',');
Object o = ja.opt(i);
if (o != null) {
  String s = o.toString();
origin: org.opencms/opencms-core

  sb.append(',');
Object o = ja.opt(i);
if (o != null) {
  String s = o.toString();
origin: org.opencms/opencms-core

final String word = words.opt(i).toString();
wordsToCheck.add(word);
origin: org.opencms/opencms-core

o = ja.opt(1);
if (o instanceof JSONObject) {
origin: org.opencms/opencms-solr

o = ja.opt(1);
if (o instanceof JSONObject) {
origin: org.opencms/opencms-core

len = ja.length();
for (i = 0; i < len; ++i) {
  b.append(toString(ja.opt(i), (tagName == null) ? "array" : tagName));
origin: org.opencms/opencms-solr

len = ja.length();
for (i = 0; i < len; ++i) {
  b.append(toString(ja.opt(i), (tagName == null) ? "array" : tagName));
origin: org.opencms/opencms-core

/**
 * Produce a JSONObject by combining a JSONArray of names with the values
 * of this JSONArray.<p>
 *
 * @param names a JSONArray containing a list of key strings. These will be
 * paired with the values
 * @return a JSONObject, or null if there are no names or if this JSONArray
 * has no values
 * @throws JSONException if any of the names are null
 */
public JSONObject toJSONObject(JSONArray names) throws JSONException {
  if ((names == null) || (names.length() == 0) || (length() == 0)) {
    return null;
  }
  JSONObject jo = new JSONObject();
  for (int i = 0; i < names.length(); i += 1) {
    jo.put(names.getString(i), opt(i));
  }
  return jo;
}
origin: org.opencms/opencms-solr

/**
 * Produce a JSONObject by combining a JSONArray of names with the values
 * of this JSONArray.<p>
 * 
 * @param names a JSONArray containing a list of key strings. These will be
 * paired with the values
 * @return a JSONObject, or null if there are no names or if this JSONArray
 * has no values
 * @throws JSONException if any of the names are null
 */
public JSONObject toJSONObject(JSONArray names) throws JSONException {
  if (names == null || names.length() == 0 || length() == 0) {
    return null;
  }
  JSONObject jo = new JSONObject();
  for (int i = 0; i < names.length(); i += 1) {
    jo.put(names.getString(i), this.opt(i));
  }
  return jo;
}
org.opencms.jsonJSONArrayopt

Javadoc

Get the optional object value associated with an index.

Popular methods of JSONArray

  • <init>
    Construct a JSONArray from a JSONTokener.
  • toString
    Make a pretty printed JSON text of this JSONArray. Warning: This method assumes that the data struct
  • get
    Get the object value associated with an index.
  • getBoolean
    Get the boolean value associated with an index. The string values "true" and "false" are converted t
  • getDouble
    Get the double value associated with an index.
  • getInt
    Get the int value associated with an index.
  • getLong
    Get the long value associated with an index.
  • getString
    Get the string associated with an index.
  • join
    Make a string from the contents of this JSONArray. The separator string is inserted between each ele
  • length
    Get the number of elements in the JSONArray, included nulls.
  • optBoolean
    Get the optional boolean value associated with an index. It returns the defaultValue if there is no
  • optDouble
    Get the optional double value associated with an index. The defaultValue is returned if there is no
  • optBoolean,
  • optDouble,
  • optInt,
  • optJSONObject,
  • optLong,
  • optString,
  • put,
  • toJSONObject,
  • write

Popular in Java

  • Reactive rest calls using spring rest template
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • startActivity (Activity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • Path (java.nio.file)
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • TimerTask (java.util)
    A task that can be scheduled for one-time or repeated execution by a Timer.
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
  • JFileChooser (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now