Codota Logo
JsonValue.asFloat
Code IndexAdd Codota to your IDE (free)

How to use
asFloat
method
in
org.hjson.JsonValue

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

  • Common ways to obtain JsonValue
private void myMethod () {
JsonValue j =
  • Codota IconJsonArray jsonArray;jsonArray.get(index)
  • Smart code suggestions by Codota
}
origin: org.hjson/hjson

/**
 * Returns the <code>float</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>float</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 float getFloat(String name, float defaultValue) {
 JsonValue value=get(name);
 return value!=null ? value.asFloat() : defaultValue;
}
origin: hjson/hjson-java

/**
 * Returns the <code>float</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>float</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 float getFloat(String name, float defaultValue) {
 JsonValue value=get(name);
 return value!=null ? value.asFloat() : defaultValue;
}
org.hjsonJsonValueasFloat

Javadoc

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

If the JSON number is out of the Float range, Float#POSITIVE_INFINITY or Float#NEGATIVE_INFINITY is returned.

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,
  • asInt,
  • asLong,
  • getType,
  • isBoolean,
  • isObject,
  • isPunctuatorChar,
  • isString

Popular in Java

  • Reactive rest calls using spring rest template
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
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