Skip to content

Commit

Permalink
Removed publicly unused static factory method for builder.
Browse files Browse the repository at this point in the history
Signed-off-by: Juergen Fickel <juergen.fickel@bosch.io>
  • Loading branch information
Juergen Fickel committed Dec 22, 2021
1 parent 7bdb628 commit 8fbbee1
Showing 1 changed file with 5 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,7 @@ public static IllegalAdaptableException newInstance(final String message,
*/
public static Builder newBuilder(final String message, final Adaptable adaptable) {
ConditionChecker.checkNotNull(adaptable, "adaptable");
return newBuilder(message, adaptable.getTopicPath(), adaptable.getDittoHeaders());
}

/**
* Returns a mutable builder with a fluent API for constructing an instance of {@code IllegalAdaptableException}.
*
* @param message the detail message of the exception.
* @param topicPath the {@code TopicPath} of the {@code Adaptable} which caused the exception to be built.
* @param dittoHeaders the {@code DittoHeaders} to use for the exception.
* @return the builder.
* @throws NullPointerException if any argument is {@code null}.
* @throws IllegalArgumentException if {@code message} is blank.
*/
public static Builder newBuilder(final String message, final TopicPath topicPath, final DittoHeaders dittoHeaders) {
return new Builder(message, topicPath, dittoHeaders);
return new Builder(message, adaptable.getTopicPath(), adaptable.getDittoHeaders());
}

/**
Expand All @@ -164,7 +150,8 @@ public static IllegalAdaptableException fromJson(final JsonObject jsonObject, fi
deserializeErrorCode(jsonObject),
deserializeHttpStatus(jsonObject),
dittoHeaders,
newBuilder(jsonObject.getValueOrThrow(JsonFields.MESSAGE), deserializeTopicPath(jsonObject),
new Builder(jsonObject.getValueOrThrow(JsonFields.MESSAGE),
deserializeTopicPath(jsonObject),
dittoHeaders)
.withSignalType(deserializeSignalType(jsonObject).orElse(null))
.withDescription(jsonObject.getValue(JsonFields.DESCRIPTION).orElse(null))
Expand Down Expand Up @@ -272,7 +259,7 @@ public DittoRuntimeException setDittoHeaders(final DittoHeaders dittoHeaders) {
getErrorCode(),
getHttpStatus(),
dittoHeaders,
newBuilder(getMessage(), topicPath, dittoHeaders)
new Builder(getMessage(), topicPath, dittoHeaders)
.withSignalType(signalType)
.withDescription(getDescription().orElse(null))
.withCause(getCause())
Expand Down Expand Up @@ -316,8 +303,8 @@ public int hashCode() {
public static final class Builder {

private final String message;
private final DittoHeaders dittoHeaders;
private final TopicPath topicPath;
private final DittoHeaders dittoHeaders;
@Nullable private CharSequence signalType;
@Nullable private String description;
@Nullable private Throwable cause;
Expand Down

0 comments on commit 8fbbee1

Please sign in to comment.