Tabnine Logo
JsonTypeNotParsableException$Builder.dittoHeaders
Code IndexAdd Tabnine to your IDE (free)

How to use
dittoHeaders
method
in
org.eclipse.ditto.signals.base.JsonTypeNotParsableException$Builder

Best Java code snippets using org.eclipse.ditto.signals.base.JsonTypeNotParsableException$Builder.dittoHeaders (Showing top 6 results out of 315)

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: org.eclipse.ditto/ditto-signals-base

/**
 * Constructs a new {@code JsonTypeNotParsableException} object with the exception message extracted from the
 * given JSON object.
 *
 * @param jsonObject the JSON to read the {@link JsonFields#MESSAGE} field from.
 * @param dittoHeaders the headers of the command which resulted in this exception.
 * @return the new JsonTypeNotParsableException.
 * @throws org.eclipse.ditto.json.JsonMissingFieldException if the {@code jsonObject} does not have the {@link
 * JsonFields#MESSAGE} field.
 */
public static JsonTypeNotParsableException fromJson(final JsonObject jsonObject,
    final DittoHeaders dittoHeaders) {
  return new Builder()
      .dittoHeaders(dittoHeaders)
      .message(readMessage(jsonObject))
      .description(readDescription(jsonObject).orElse(DEFAULT_DESCRIPTION))
      .href(readHRef(jsonObject).orElse(null))
      .build();
}
origin: eclipse/ditto

/**
 * Constructs a new {@code JsonTypeNotParsableException} object with the exception message extracted from the
 * given JSON object.
 *
 * @param jsonObject the JSON to read the {@link JsonFields#MESSAGE} field from.
 * @param dittoHeaders the headers of the command which resulted in this exception.
 * @return the new JsonTypeNotParsableException.
 * @throws org.eclipse.ditto.json.JsonMissingFieldException if the {@code jsonObject} does not have the {@link
 * JsonFields#MESSAGE} field.
 */
public static JsonTypeNotParsableException fromJson(final JsonObject jsonObject,
    final DittoHeaders dittoHeaders) {
  return new Builder()
      .dittoHeaders(dittoHeaders)
      .message(readMessage(jsonObject))
      .description(readDescription(jsonObject).orElse(DEFAULT_DESCRIPTION))
      .href(readHRef(jsonObject).orElse(null))
      .build();
}
origin: eclipse/ditto

/**
 * Constructs a new {@code JsonTypeNotParsableException} object with given message.
 *
 * @param message detail message. This message can be later retrieved by the {@link #getMessage()} method.
 * @param dittoHeaders the headers of the command which resulted in this exception.
 * @return the new JsonTypeNotParsableException.
 */
public static JsonTypeNotParsableException fromMessage(final String message, final DittoHeaders dittoHeaders) {
  return new Builder()
      .dittoHeaders(dittoHeaders)
      .message(message)
      .build();
}
origin: org.eclipse.ditto/ditto-signals-base

/**
 * Constructs a new {@code JsonTypeNotParsableException} object with given message.
 *
 * @param message detail message. This message can be later retrieved by the {@link #getMessage()} method.
 * @param dittoHeaders the headers of the command which resulted in this exception.
 * @return the new JsonTypeNotParsableException.
 */
public static JsonTypeNotParsableException fromMessage(final String message, final DittoHeaders dittoHeaders) {
  return new Builder()
      .dittoHeaders(dittoHeaders)
      .message(message)
      .build();
}
org.eclipse.ditto.signals.baseJsonTypeNotParsableException$BuilderdittoHeaders

Popular methods of JsonTypeNotParsableException$Builder

  • <init>
  • description
  • message

Popular in Java

  • Updating database using SQL prepared statement
  • startActivity (Activity)
  • onCreateOptionsMenu (Activity)
  • requestLocationUpdates (LocationManager)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Notification (javax.management)
  • Table (org.hibernate.mapping)
    A relational table
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Github Copilot alternatives
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