cz.active24.client.fred.eppclient.SuccessfulResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fred-client Show documentation
Show all versions of fred-client Show documentation
A Java EPP client for FRED (Free Registry for ENUM and Domains)
package cz.active24.client.fred.eppclient;
import java.util.ArrayList;
import java.util.List;
/**
* Successful responses which can be returned from FRED.
*
*
* - {@link SuccessfulResponse#code} - result code (4-digit number)
* - {@link SuccessfulResponse#message} - human-readable description of the result
*
*
* @see FRED documentation
*/
public enum SuccessfulResponse {
RESPONSE_1000(1000, "Command completed successfully"),
RESPONSE_1001(1001, "Command completed successfully; action pending"),
RESPONSE_1300(1300, "Command completed successfully; no messages"),
RESPONSE_1301(1301, "Command completed successfully; ack to dequeue"),
RESPONSE_1500(1500, "Command completed successfully; ending session");
private int code;
private String message;
SuccessfulResponse(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
public static List getAllSuccessfulCodes() {
List successfulCodes = new ArrayList();
for (SuccessfulResponse successfulResponse : SuccessfulResponse.values()) {
successfulCodes.add(successfulResponse.getCode());
}
return successfulCodes;
}
public static SuccessfulResponse fromValue(int code) {
for (SuccessfulResponse value : SuccessfulResponse.values()) {
if (value.getCode() == code) {
return value;
}
}
throw new IllegalArgumentException(String.valueOf(code));
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder(SuccessfulResponse.class.getSimpleName());
sb.append("{code=").append(code);
sb.append(", message='").append(message).append('\'');
sb.append('}');
return sb.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy