zepengdev
2025-06-22 9fcffba8403c50c87006ce8c58d980e0d0ccf892
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package com.oying.exception;
 
import org.springframework.util.StringUtils;
 
/**
 * @author Z
 * @date 2018-11-23
 */
public class EntityExistException extends RuntimeException {
 
    public EntityExistException(Class clazz, String field, String val) {
        super(EntityExistException.generateMessage(clazz.getSimpleName(), field, val));
    }
 
    private static String generateMessage(String entity, String field, String val) {
        return StringUtils.capitalize(entity)
                + " with " + field + " "+ val + " existed";
    }
}