renamed enum classes
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.vaessl.app.connection;
|
||||
|
||||
|
||||
public enum Endpoint {
|
||||
HOMEBOX_LOGIN("/api/v1/users/login"), LOGIN("/login");
|
||||
|
||||
private final String value;
|
||||
|
||||
private Endpoint(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.vaessl.app.connection;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum Endpoints {
|
||||
HOMEBOX_LOGIN("/api/v1/users/login");
|
||||
|
||||
private final String endpoint;
|
||||
|
||||
Endpoints(String endpoint){
|
||||
this.endpoint = endpoint;
|
||||
}
|
||||
}
|
||||
+15
-6
@@ -2,25 +2,34 @@ package com.vaessl.app.exception;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import lombok.Getter;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
@Getter
|
||||
public enum ErrorMessages {
|
||||
public enum ErrorMessage {
|
||||
BAD_REQUEST_EMPTY_FIELDS(HttpStatus.BAD_REQUEST, "Fields must not be empty."), UNAUTHORIZED_WRONG_LOGIN(
|
||||
HttpStatus.UNAUTHORIZED, "Invalid username or password."), SERVICE_UNAVAILABLE_UNREACHABLE_URL(
|
||||
HttpStatus.SERVICE_UNAVAILABLE, "The target URL is unreachable."), SERVER_ERROR_GENERAL(
|
||||
"The external app returned a server error: ");
|
||||
"The external app returned a server error: "), WRONG_SERVICE_TYPE(HttpStatus.BAD_REQUEST,
|
||||
"No such service type.");
|
||||
|
||||
private final HttpStatus status;
|
||||
private final String message;
|
||||
|
||||
ErrorMessages(HttpStatus status, String message) {
|
||||
private ErrorMessage(HttpStatus status, String message) {
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
ErrorMessages(String message) {
|
||||
private ErrorMessage(String message) {
|
||||
this.status = null;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public HttpStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user