Java tutorial
/* * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.wiiyaya.framework.common.exception; /** * <p>??</p> * * <p>??{@link org.springframework.validation.annotation.Validated}??</p> * * <p>??attr.???.</p> * * @author wiiyaya * */ public class ValidateException extends Exception { private static final long serialVersionUID = 7450363518285869297L; private final String objectName; private final String field; private final String defaultMessage; public ValidateException(String objectName, String field, String defaultMessage) { this.objectName = objectName; this.field = field; this.defaultMessage = defaultMessage; } public String getCode() { return "attr." + objectName + "." + field; } public String getDefaultMessage() { return defaultMessage; } }