Skip to content

Commit

Permalink
fix typo GeneratorExceptionBuilder (#7288)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-c-morel authored and DamnClin committed Aug 27, 2023
1 parent 11336f6 commit 5854048
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class InvalidLandscapeException extends GeneratorException {

private InvalidLandscapeException(GeneratorExeptionBuilder builder) {
private InvalidLandscapeException(GeneratorExceptionBuilder builder) {
super(builder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ public class GeneratorException extends RuntimeException {
private final ErrorStatus status;
private final Map<String, String> parameters;

protected GeneratorException(GeneratorExeptionBuilder builder) {
protected GeneratorException(GeneratorExceptionBuilder builder) {
super(buildMessage(builder), builder.cause);
key = buildKey(builder);
status = buildStatus(builder);
parameters = Collections.unmodifiableMap(builder.parameters);
}

private static String buildMessage(GeneratorExeptionBuilder builder) {
private static String buildMessage(GeneratorExceptionBuilder builder) {
Assert.notNull("builder", builder);

if (builder.message == null) {
Expand All @@ -29,15 +29,15 @@ private static String buildMessage(GeneratorExeptionBuilder builder) {
return builder.message;
}

private ErrorKey buildKey(GeneratorExeptionBuilder builder) {
private ErrorKey buildKey(GeneratorExceptionBuilder builder) {
if (builder.key == null) {
return StandardErrorKey.INTERNAL_SERVER_ERROR;
}

return builder.key;
}

private ErrorStatus buildStatus(GeneratorExeptionBuilder builder) {
private ErrorStatus buildStatus(GeneratorExceptionBuilder builder) {
if (builder.status == null) {
return defaultStatus();
}
Expand Down Expand Up @@ -69,11 +69,11 @@ private Predicate<String> inPrimary() {
return className -> className.contains(".primary");
}

public static GeneratorExeptionBuilder internalServerError(ErrorKey key) {
public static GeneratorExceptionBuilder internalServerError(ErrorKey key) {
return builder(key).status(ErrorStatus.INTERNAL_SERVER_ERROR);
}

public static GeneratorExeptionBuilder badRequest(ErrorKey key) {
public static GeneratorExceptionBuilder badRequest(ErrorKey key) {
return builder(key).status(ErrorStatus.BAD_REQUEST);
}

Expand All @@ -85,8 +85,8 @@ public static GeneratorException technicalError(String message, Throwable cause)
return builder(StandardErrorKey.INTERNAL_SERVER_ERROR).message(message).cause(cause).build();
}

public static GeneratorExeptionBuilder builder(ErrorKey key) {
return new GeneratorExeptionBuilder(key);
public static GeneratorExceptionBuilder builder(ErrorKey key) {
return new GeneratorExceptionBuilder(key);
}

public ErrorKey key() {
Expand All @@ -101,7 +101,7 @@ public Map<String, String> parameters() {
return parameters;
}

public static class GeneratorExeptionBuilder {
public static class GeneratorExceptionBuilder {

private final ErrorKey key;
private final Map<String, String> parameters = new HashMap<>();
Expand All @@ -110,31 +110,31 @@ public static class GeneratorExeptionBuilder {
private Throwable cause;
private ErrorStatus status;

private GeneratorExeptionBuilder(ErrorKey key) {
private GeneratorExceptionBuilder(ErrorKey key) {
this.key = key;
}

public GeneratorExeptionBuilder message(String message) {
public GeneratorExceptionBuilder message(String message) {
this.message = message;

return this;
}

public GeneratorExeptionBuilder cause(Throwable cause) {
public GeneratorExceptionBuilder cause(Throwable cause) {
this.cause = cause;

return this;
}

public GeneratorExeptionBuilder addParameters(Map<String, String> parameters) {
public GeneratorExceptionBuilder addParameters(Map<String, String> parameters) {
Assert.notNull("parameters", parameters);

parameters.forEach(this::addParameter);

return this;
}

public GeneratorExeptionBuilder addParameter(String key, String value) {
public GeneratorExceptionBuilder addParameter(String key, String value) {
Assert.notBlank("key", key);
Assert.notNull("value", value);

Expand All @@ -143,7 +143,7 @@ public GeneratorExeptionBuilder addParameter(String key, String value) {
return this;
}

public GeneratorExeptionBuilder status(ErrorStatus status) {
public GeneratorExceptionBuilder status(ErrorStatus status) {
this.status = status;

return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ public class {{ baseName }}Exception extends RuntimeException {
private final ErrorStatus status;
private final Map<String, String> parameters;
protected {{ baseName }}Exception({{ baseName }}ExeptionBuilder builder) {
protected {{ baseName }}Exception({{ baseName }}ExceptionBuilder builder) {
super(buildMessage(builder), builder.cause);
key = buildKey(builder);
status = buildStatus(builder);
parameters = Collections.unmodifiableMap(builder.parameters);
}

private static String buildMessage({{ baseName }}ExeptionBuilder builder) {
private static String buildMessage({{ baseName }}ExceptionBuilder builder) {
Assert.notNull("builder", builder);
if (builder.message == null) {
Expand All @@ -29,15 +29,15 @@ public class {{ baseName }}Exception extends RuntimeException {
return builder.message;
}

private ErrorKey buildKey({{ baseName }}ExeptionBuilder builder) {
private ErrorKey buildKey({{ baseName }}ExceptionBuilder builder) {
if (builder.key == null) {
return StandardErrorKey.INTERNAL_SERVER_ERROR;
}

return builder.key;
}

private ErrorStatus buildStatus({{ baseName }}ExeptionBuilder builder) {
private ErrorStatus buildStatus({{ baseName }}ExceptionBuilder builder) {
if (builder.status == null) {
return defaultStatus();
}
Expand Down Expand Up @@ -69,11 +69,11 @@ public class {{ baseName }}Exception extends RuntimeException {
return className -> className.contains(".primary");
}

public static {{ baseName }}ExeptionBuilder internalServerError(ErrorKey key) {
public static {{ baseName }}ExceptionBuilder internalServerError(ErrorKey key) {
return builder(key).status(ErrorStatus.INTERNAL_SERVER_ERROR);
}

public static {{ baseName }}ExeptionBuilder badRequest(ErrorKey key) {
public static {{ baseName }}ExceptionBuilder badRequest(ErrorKey key) {
return builder(key).status(ErrorStatus.BAD_REQUEST);
}

Expand All @@ -85,8 +85,8 @@ public class {{ baseName }}Exception extends RuntimeException {
return builder(StandardErrorKey.INTERNAL_SERVER_ERROR).message(message).cause(cause).build();
}

public static {{ baseName }}ExeptionBuilder builder(ErrorKey key) {
return new {{ baseName }}ExeptionBuilder(key);
public static {{ baseName }}ExceptionBuilder builder(ErrorKey key) {
return new {{ baseName }}ExceptionBuilder(key);
}

public ErrorKey key() {
Expand All @@ -101,7 +101,7 @@ public class {{ baseName }}Exception extends RuntimeException {
return parameters;
}

public static class {{ baseName }}ExeptionBuilder {
public static class {{ baseName }}ExceptionBuilder {
private final ErrorKey key;
private final Map<String, String> parameters = new HashMap<>();
Expand All @@ -110,31 +110,31 @@ public class {{ baseName }}Exception extends RuntimeException {
private Throwable cause;
private ErrorStatus status;
private {{ baseName }}ExeptionBuilder(ErrorKey key) {
private {{ baseName }}ExceptionBuilder(ErrorKey key) {
this.key = key;
}

public {{ baseName }}ExeptionBuilder message(String message) {
public {{ baseName }}ExceptionBuilder message(String message) {
this.message = message;
return this;
}

public {{ baseName }}ExeptionBuilder cause(Throwable cause) {
public {{ baseName }}ExceptionBuilder cause(Throwable cause) {
this.cause = cause;
return this;
}

public {{ baseName }}ExeptionBuilder addParameters(Map<String, String> parameters) {
public {{ baseName }}ExceptionBuilder addParameters(Map<String, String> parameters) {
Assert.notNull("parameters", parameters);
parameters.forEach(this::addParameter);
return this;
}

public {{ baseName }}ExeptionBuilder addParameter(String key, String value) {
public {{ baseName }}ExceptionBuilder addParameter(String key, String value) {
Assert.notBlank("key", key);
Assert.notNull("value", value);
Expand All @@ -143,7 +143,7 @@ public class {{ baseName }}Exception extends RuntimeException {
return this;
}

public {{ baseName }}ExeptionBuilder status(ErrorStatus status) {
public {{ baseName }}ExceptionBuilder status(ErrorStatus status) {
this.status = status;
return this;
Expand Down

0 comments on commit 5854048

Please sign in to comment.