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

How to use
toString
method
in
org.hjson.JsonValue

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

origin: org.hjson/hjson

/**
 * Returns the JSON string for this value in its minimal form, without any additional whitespace.
 * The result is guaranteed to be a valid input for the method {@link #readJSON(String)} and to
 * create a value that is <em>equal</em> to this object.
 *
 * @return a JSON string that represents this value
 */
@Override
public String toString() {
 return toString(Stringify.PLAIN);
}
origin: hjson/hjson-java

/**
 * Returns the JSON string for this value in its minimal form, without any additional whitespace.
 * The result is guaranteed to be a valid input for the method {@link #readJSON(String)} and to
 * create a value that is <em>equal</em> to this object.
 *
 * @return a JSON string that represents this value
 */
@Override
public String toString() {
 return toString(Stringify.PLAIN);
}
origin: org.hjson/hjson

/**
 * Returns this JSON value as {@link JsonObject}, assuming that this value represents a JSON
 * object. If this is not the case, an exception is thrown.
 *
 * @return a JSONObject for this value
 * @throws UnsupportedOperationException if this value is not a JSON object
 */
public JsonObject asObject() {
 throw new UnsupportedOperationException("Not an object: "+toString());
}
origin: org.hjson/hjson

/**
 * Returns this JSON value as String, assuming that this value represents a JSON string. If this
 * is not the case, an exception is thrown.
 *
 * @return the string represented by this value
 * @throws UnsupportedOperationException if this value is not a JSON string
 */
public String asString() {
 throw new UnsupportedOperationException("Not a string: "+toString());
}
origin: org.hjson/hjson

/**
 * Returns this JSON value as a <code>boolean</code> value, assuming that this value is either
 * <code>true</code> or <code>false</code>. If this is not the case, an exception is thrown.
 *
 * @return this value as <code>boolean</code>
 * @throws UnsupportedOperationException if this value is neither <code>true</code> or <code>false</code>
 */
public boolean asBoolean() {
 throw new UnsupportedOperationException("Not a boolean: "+toString());
}
origin: hjson/hjson-java

/**
 * Returns this JSON value as {@link JsonObject}, assuming that this value represents a JSON
 * object. If this is not the case, an exception is thrown.
 *
 * @return a JSONObject for this value
 * @throws UnsupportedOperationException if this value is not a JSON object
 */
public JsonObject asObject() {
 throw new UnsupportedOperationException("Not an object: "+toString());
}
origin: org.hjson/hjson

/**
 * Returns this JSON value as a <code>double</code> value, assuming that this value represents a
 * JSON number. If this is not the case, an exception is thrown.
 * <p>
 * If the JSON number is out of the <code>Double</code> range, {@link Double#POSITIVE_INFINITY} or
 * {@link Double#NEGATIVE_INFINITY} is returned.
 * </p>
 *
 * @return this value as <code>double</code>
 * @throws UnsupportedOperationException if this value is not a JSON number
 */
public double asDouble() {
 throw new UnsupportedOperationException("Not a number: "+toString());
}
origin: org.hjson/hjson

/**
 * Returns this JSON value as {@link JsonArray}, assuming that this value represents a JSON array.
 * If this is not the case, an exception is thrown.
 *
 * @return a JSONArray for this value
 * @throws UnsupportedOperationException if this value is not a JSON array
 */
public JsonArray asArray() {
 throw new UnsupportedOperationException("Not an array: "+toString());
}
origin: hjson/hjson-java

/**
 * Returns this JSON value as String, assuming that this value represents a JSON string. If this
 * is not the case, an exception is thrown.
 *
 * @return the string represented by this value
 * @throws UnsupportedOperationException if this value is not a JSON string
 */
public String asString() {
 throw new UnsupportedOperationException("Not a string: "+toString());
}
origin: org.hjson/hjson

/**
 * Returns this JSON value as a <code>float</code> value, assuming that this value represents a
 * JSON number. If this is not the case, an exception is thrown.
 * <p>
 * If the JSON number is out of the <code>Float</code> range, {@link Float#POSITIVE_INFINITY} or
 * {@link Float#NEGATIVE_INFINITY} is returned.
 * </p>
 *
 * @return this value as <code>float</code>
 * @throws UnsupportedOperationException if this value is not a JSON number
 */
public float asFloat() {
 throw new UnsupportedOperationException("Not a number: "+toString());
}
origin: org.apereo.cas/cas-server-support-pm

private void readAccountsFromJsonResource() {
  try (Reader reader = new InputStreamReader(jsonResource.getInputStream(), StandardCharsets.UTF_8)) {
    final TypeReference<Map<String, JsonBackedAccount>> personList = new TypeReference<>() {
    };
    this.jsonBackedAccounts = MAPPER.readValue(JsonValue.readHjson(reader).toString(), personList);
  } catch (final Exception e) {
    LOGGER.warn(e.getMessage(), e);
  }
}
origin: org.apereo.cas/cas-mgmt-core-authz

@SneakyThrows
private void loadResource(final Resource res) {
  try (Reader reader = new InputStreamReader(res.getInputStream(), StandardCharsets.UTF_8)) {
    val personList = new TypeReference<Map<String, UserAuthorizationDefinition>>() {
    };
    this.rules = this.objectMapper.readValue(JsonValue.readHjson(reader).toString(), personList);
  }
}
origin: org.apereo.cas/cas-server-core-util-api

@Override
@SneakyThrows
public void to(final OutputStream out, final T object) {
  try (val writer = new StringWriter()) {
    this.objectMapper.writer(this.prettyPrinter).writeValue(writer, object);
    val hjsonString = isJsonFormat()
      ? JsonValue.readHjson(writer.toString()).toString(Stringify.HJSON)
      : writer.toString();
    IOUtils.write(hjsonString, out, StandardCharsets.UTF_8);
  }
}
origin: org.apereo.cas/cas-server-core-util-api

/**
 * Read json from stream.
 *
 * @param json the json
 * @return the string
 * @throws IOException the io exception
 */
protected String readJsonFrom(final InputStream json) throws IOException {
  return isJsonFormat()
    ? JsonValue.readHjson(IOUtils.toString(json, StandardCharsets.UTF_8)).toString()
    : String.join("\n", IOUtils.readLines(json, StandardCharsets.UTF_8));
}
origin: org.apereo.cas/cas-server-support-interrupt-core

  @SneakyThrows
  private void readResourceForInterrupts() {
    this.interrupts = new LinkedHashMap<>();
    if (ResourceUtils.doesResourceExist(resource)) {
      try (Reader reader = new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8)) {
        final TypeReference<Map<String, InterruptResponse>> personList = new TypeReference<>() {
        };
        this.interrupts = MAPPER.readValue(JsonValue.readHjson(reader).toString(), personList);
      }
    }
  }
}
origin: org.jasig.cas/cas-server-core-util

@Override
public T fromJson(final String json) {
  try {
    final String jsonString = JsonValue.readHjson(json).toString();
    return this.objectMapper.readValue(jsonString, getTypeToSerialize());
  } catch (final Exception e) {
    throw new IllegalArgumentException(e);
  }
}
origin: org.apereo.cas/cas-server-support-oauth

@Override
public String render(final Map<String, Object> model, final AccessToken accessToken) {
  val value = getRenderedUserProfile(model);
  LOGGER.debug("Final user profile is [{}]", JsonValue.readHjson(value).toString(Stringify.FORMATTED));
  return value;
}
origin: org.apereo.cas/cas-server-core-util-api

@Override
@SneakyThrows
public T from(final File json) {
  val string = isJsonFormat()
    ? JsonValue.readHjson(FileUtils.readFileToString(json, StandardCharsets.UTF_8)).toString()
    : FileUtils.readFileToString(json, StandardCharsets.UTF_8);
  return readObjectFromString(string);
}
origin: org.apereo.cas/cas-server-core-util-api

@Override
@SneakyThrows
public T from(final Reader json) {
  val string = isJsonFormat()
    ? JsonValue.readHjson(json).toString()
    : String.join("\n", IOUtils.readLines(json));
  return readObjectFromString(string);
}
origin: org.apereo.cas/cas-server-core-util-api

@Override
@SneakyThrows
public T from(final String json) {
  val jsonString = isJsonFormat() ? JsonValue.readHjson(json).toString() : json;
  return readObjectFromString(jsonString);
}
org.hjsonJsonValuetoString

Javadoc

Returns the JSON string for this value in its minimal form, without any additional whitespace. The result is guaranteed to be a valid input for the method #readJSON(String) and to create a value that is equal to this object.

Popular methods of JsonValue

  • 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.
  • 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

  • Start an intent from android
  • getSupportFragmentManager (FragmentActivity)
  • getSystemService (Context)
  • setContentView (Activity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Best IntelliJ plugins
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