Skip to content

Commit

Permalink
Eliminate some unused builders (#1061)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoenig10 authored Jan 3, 2024
1 parent 57ef485 commit 388898c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* the HTTP specification, errors associated with a {@code 4xx} HTTP status code are client errors, and errors
* associated with a {@code 5xx} status are server errors.
*/
@Value.Immutable
@Value.Immutable(builder = false)
@ImmutablesStyle
public abstract class ErrorType {

Expand Down Expand Up @@ -68,15 +68,18 @@ public enum Code {
public static final ErrorType TIMEOUT = create(Code.TIMEOUT, "Default:Timeout");

/** The {@link Code} of this error. */
@Value.Parameter
public abstract Code code();

/**
* The name of this error type. Names should be compile-time constants and are considered part of the API of a
* service that produces this error.
*/
@Value.Parameter
public abstract String name();

/** The HTTP error code used to convey this error to HTTP clients. */
@Value.Parameter
public abstract int httpErrorCode();

@Value.Check
Expand All @@ -90,10 +93,6 @@ final void check() {

/** Constructs an {@link ErrorType} with the given error {@link Code} and name. */
public static ErrorType create(Code code, String name) {
return ImmutableErrorType.builder()
.code(code)
.name(name)
.httpErrorCode(code.httpErrorCode)
.build();
return ImmutableErrorType.of(code, name, code.httpErrorCode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.immutables.value.Value.Immutable;

@DoNotLog
@Immutable
@Immutable(builder = false)
@JsonSerialize(as = ImmutableBasicCredentials.class)
@JsonDeserialize(as = ImmutableBasicCredentials.class)
@ImmutablesStyle
Expand Down

0 comments on commit 388898c

Please sign in to comment.