congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
JsonValue.asInt
Code IndexAdd Tabnine to your IDE (free)

How to use
asInt
method
in
org.hjson.JsonValue

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

origin: org.hjson/hjson

/**
 * Returns the <code>int</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 will be picked. If this
 * member's value does not represent a JSON number or if it cannot be interpreted as Java
 * <code>int</code>, 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 int getInt(String name, int defaultValue) {
 JsonValue value=get(name);
 return value!=null ? value.asInt() : defaultValue;
}
origin: hjson/hjson-java

/**
 * Returns the <code>int</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 will be picked. If this
 * member's value does not represent a JSON number or if it cannot be interpreted as Java
 * <code>int</code>, 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 int getInt(String name, int defaultValue) {
 JsonValue value=get(name);
 return value!=null ? value.asInt() : defaultValue;
}
org.hjsonJsonValueasInt

Javadoc

Returns this JSON value as an int value, assuming that this value represents a JSON number that can be interpreted as Java int. If this is not the case, an exception is thrown.

To be interpreted as Java int, the JSON number must neither contain an exponent nor a fraction part. Moreover, the number must be in the Integer range.

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
  • asString
    Returns this JSON value as String, assuming that this value represents a JSON string. If this is not
  • 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.
  • hashCode,
  • readJSON,
  • asFloat,
  • asLong,
  • getType,
  • isBoolean,
  • isObject,
  • isPunctuatorChar,
  • isString

Popular in Java

  • Reading from database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • getSystemService (Context)
  • requestLocationUpdates (LocationManager)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • String (java.lang)
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • JCheckBox (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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