All Downloads are FREE. Search and download functionalities are using the official Maven repository.

restx.exceptions.ErrorDescriptor Maven / Gradle / Ivy

There is a newer version: 1.2.0-rc2
Show newest version
package restx.exceptions;

import com.google.common.collect.ImmutableMap;

/**
 * User: xavierhanin
 * Date: 3/19/13
 * Time: 10:25 PM
 */
public class ErrorDescriptor {
    private final int errorStatus;
    private final String errorCode;
    private final String description;
    private final ImmutableMap fields;

    public ErrorDescriptor(int errorStatus, String errorCode, String description,
                           ImmutableMap fields) {
        this.errorStatus = errorStatus;
        this.errorCode = errorCode;
        this.description = description;
        this.fields = fields;
    }

    @Override
    public String toString() {
        return "ErrorDescriptor{" +
                "errorStatus=" + errorStatus +
                ", errorCode='" + errorCode + '\'' +
                ", description='" + description + '\'' +
                ", fields=" + fields +
                '}';
    }

    public int getErrorStatus() {
        return errorStatus;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public String getDescription() {
        return description;
    }

    public ImmutableMap getFields() {
        return fields;
    }

    public static class ErrorFieldDescriptor {
        private final String field;
        private final String description;

        public ErrorFieldDescriptor(String field, String description) {
            this.field = field;
            this.description = description;
        }

        public String getField() {
            return field;
        }

        public String getDescription() {
            return description;
        }

        @Override
        public String toString() {
            return "ErrorFieldDescriptor{" +
                    "field='" + field + '\'' +
                    ", description='" + description + '\'' +
                    '}';
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy