/** * Copyright (C) 2018-2020 * All rights reserved, Designed By www.yixiang.co * 注意: * 本软件为www.yixiang.co开发研制 */ package com.sandu.common.execption; import org.springframework.util.StringUtils; /** * @author Zheng Jie * @date 2018-11-23 */ public class EntityExistException extends RuntimeException { public EntityExistException(Class clazz, String field, Object val) { super(EntityExistException.generateMessage(clazz.getSimpleName(), field, val)); } private static String generateMessage(String entity, String field, Object val) { return StringUtils.capitalize(entity) + " with " + field + " " + val + " existed"; } }