congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
AbstractJsonParsableRegistry
Code IndexAdd Tabnine to your IDE (free)

How to use
AbstractJsonParsableRegistry
in
org.eclipse.ditto.signals.base

Best Java code snippets using org.eclipse.ditto.signals.base.AbstractJsonParsableRegistry (Showing top 4 results out of 315)

origin: org.eclipse.ditto/ditto-signals-base

private T fromJson(final String jsonString, final DittoHeaders dittoHeaders) {
  final JsonObject jsonObject = JsonFactory.newObject(jsonString);
  return fromJson(jsonObject, dittoHeaders);
}
origin: org.eclipse.ditto/ditto-signals-base

private T fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) {
  final String type = resolveType(jsonObject);
  final JsonParsable<T> jsonObjectParsable = parseStrategies.get(type);
  if (null != jsonObjectParsable) {
    try {
      return jsonObjectParsable.parse(jsonObject, dittoHeaders);
    } catch (final JsonRuntimeException jre) {
      final JsonExceptionBuilder builder = JsonRuntimeException.newBuilder(jre.getErrorCode())
          .message("Error when parsing Json type '" + type + "': " + jre.getMessage())
          .cause(jre.getCause());
      jre.getDescription().ifPresent(builder::description);
      jre.getHref().ifPresent(builder::href);
      // rethrow after enhancing the exception with the type which failed to parse
      throw (JsonRuntimeException) builder.build();
    }
  } else {
    throw JsonTypeNotParsableException.newBuilder(type, getClass().getSimpleName())
        .dittoHeaders(dittoHeaders)
        .build();
  }
}
origin: eclipse/ditto

private T fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) {
  final String type = resolveType(jsonObject);
  final JsonParsable<T> jsonObjectParsable = parseStrategies.get(type);
  if (null != jsonObjectParsable) {
    try {
      return jsonObjectParsable.parse(jsonObject, dittoHeaders);
    } catch (final JsonRuntimeException jre) {
      final JsonExceptionBuilder builder = JsonRuntimeException.newBuilder(jre.getErrorCode())
          .message("Error when parsing Json type '" + type + "': " + jre.getMessage())
          .cause(jre.getCause());
      jre.getDescription().ifPresent(builder::description);
      jre.getHref().ifPresent(builder::href);
      // rethrow after enhancing the exception with the type which failed to parse
      throw (JsonRuntimeException) builder.build();
    }
  } else {
    throw JsonTypeNotParsableException.newBuilder(type, getClass().getSimpleName())
        .dittoHeaders(dittoHeaders)
        .build();
  }
}
origin: eclipse/ditto

private T fromJson(final String jsonString, final DittoHeaders dittoHeaders) {
  final JsonObject jsonObject = JsonFactory.newObject(jsonString);
  return fromJson(jsonObject, dittoHeaders);
}
org.eclipse.ditto.signals.baseAbstractJsonParsableRegistry

Javadoc

Abstract implementation of JsonParsableRegistry.

Most used methods

  • fromJson
  • resolveType
    Function that resolves the type out of the given JSON object.

Popular in Java

  • Finding current android device location
  • findViewById (Activity)
  • setScale (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Path (java.nio.file)
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top Sublime Text 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