Java 类org.springframework.core.ErrorCoded 实例源码

项目:spring-rich-client    文件:MessagesDialogExceptionHandler.java   
protected String[] getMessagesKeys(Throwable throwable, String keySuffix) {
    if (messagesKey != null) {
        return new String[] {messagesKey};
    }
    List<String> messageKeyList = new ArrayList<String>();
    Class clazz = throwable.getClass();
    if (throwable instanceof ErrorCoded)
    {
        messageKeyList.add(((ErrorCoded) throwable).getErrorCode() + keySuffix);
    }
    if (throwable instanceof SQLException)
    {
        messageKeyList.add(SQLException.class.getName() + "." + ((SQLException) throwable).getErrorCode() + keySuffix);
    }
    while (clazz != Object.class) {
        messageKeyList.add(clazz.getName() + keySuffix);
        clazz = clazz.getSuperclass();
    }
    return messageKeyList.toArray(new String[messageKeyList.size()]);
}
项目:spring-richclient    文件:MessagesDialogExceptionHandler.java   
protected String[] getMessagesKeys(Throwable throwable, String keySuffix) {
    if (messagesKey != null) {
        return new String[] {messagesKey};
    }
    List<String> messageKeyList = new ArrayList<String>();
    Class clazz = throwable.getClass();
    if (throwable instanceof ErrorCoded)
    {
        messageKeyList.add(((ErrorCoded) throwable).getErrorCode() + keySuffix);
    }
    if (throwable instanceof SQLException)
    {
        messageKeyList.add(SQLException.class.getName() + "." + ((SQLException) throwable).getErrorCode() + keySuffix);
    }
    while (clazz != Object.class) {
        messageKeyList.add(clazz.getName() + keySuffix);
        clazz = clazz.getSuperclass();
    }
    return messageKeyList.toArray(new String[messageKeyList.size()]);
}
项目:spring-rich-client    文件:AbstractLoggingExceptionHandler.java   
protected String extractErrorCode(Throwable throwable) {
    if (throwable instanceof ErrorCoded) {
        return ((ErrorCoded) throwable).getErrorCode();
    } else if (throwable instanceof SQLException) {
        return Integer.toString(((SQLException) throwable).getErrorCode());
    } else {
        return null;
    }
}
项目:spring-richclient    文件:AbstractLoggingExceptionHandler.java   
protected String extractErrorCode(Throwable throwable) {
    if (throwable instanceof ErrorCoded) {
        return ((ErrorCoded) throwable).getErrorCode();
    } else if (throwable instanceof SQLException) {
        return Integer.toString(((SQLException) throwable).getErrorCode());
    } else {
        return null;
    }
}