[New] Added StrolchException overrides for I18nMessage parameter

This commit is contained in:
Robert von Burg 2022-02-28 23:35:34 +01:00
parent 15a84b99ce
commit 1ccc6ec730
7 changed files with 50 additions and 19 deletions

View File

@ -1,12 +1,12 @@
/*
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
*
*
* 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.
@ -15,15 +15,16 @@
*/
package li.strolch.agent.api;
import java.util.Locale;
import li.strolch.exception.StrolchException;
import li.strolch.utils.I18nMessage;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public class StrolchLockException extends StrolchException {
public StrolchLockException(String message, Throwable cause) {
super(message, cause);
}
@ -31,4 +32,8 @@ public class StrolchLockException extends StrolchException {
public StrolchLockException(String message) {
super(message);
}
public StrolchLockException(I18nMessage i18n) {
super(i18n.getMessage(Locale.getDefault()));
}
}

View File

@ -15,6 +15,8 @@
*/
package li.strolch.exception;
import java.util.Locale;
import li.strolch.privilege.model.Certificate;
import li.strolch.privilege.model.Restrictable;
import li.strolch.utils.I18nMessage;

View File

@ -1,5 +1,9 @@
package li.strolch.exception;
import java.util.Locale;
import li.strolch.utils.I18nMessage;
public class StrolchElementNotFoundException extends StrolchModelException {
public StrolchElementNotFoundException(String message, Throwable cause) {
@ -9,4 +13,8 @@ public class StrolchElementNotFoundException extends StrolchModelException {
public StrolchElementNotFoundException(String message) {
super(message);
}
public StrolchElementNotFoundException(I18nMessage i18n) {
super(i18n.getMessage(Locale.getDefault()));
}
}

View File

@ -15,6 +15,8 @@
*/
package li.strolch.exception;
import java.util.Locale;
import li.strolch.utils.I18nMessage;
/**
@ -32,6 +34,10 @@ public class StrolchException extends RuntimeException {
super(message);
}
public StrolchException(I18nMessage i18n) {
super(i18n.getMessage(Locale.getDefault()));
}
public boolean hasI18n() {
return this.i18n != null;
}

View File

@ -15,23 +15,24 @@
*/
package li.strolch.exception;
import java.util.Locale;
import li.strolch.utils.I18nMessage;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public class StrolchModelException extends StrolchException {
/**
* @param message
* @param cause
*/
public StrolchModelException(String message, Throwable cause) {
super(message, cause);
}
/**
* @param message
*/
public StrolchModelException(String message) {
super(message);
}
public StrolchModelException(I18nMessage i18n) {
super(i18n.getMessage(Locale.getDefault()));
}
}

View File

@ -15,6 +15,10 @@
*/
package li.strolch.exception;
import java.util.Locale;
import li.strolch.utils.I18nMessage;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*/
@ -27,4 +31,8 @@ public class StrolchNotAuthenticatedException extends StrolchException {
public StrolchNotAuthenticatedException(String message, Throwable cause) {
super(message, cause);
}
public StrolchNotAuthenticatedException(I18nMessage i18n) {
super(i18n.getMessage(Locale.getDefault()));
}
}

View File

@ -15,23 +15,24 @@
*/
package li.strolch.exception;
import java.util.Locale;
import li.strolch.utils.I18nMessage;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public class StrolchPolicyException extends StrolchException {
/**
* @param message
* @param cause
*/
public StrolchPolicyException(String message, Throwable cause) {
super(message, cause);
}
/**
* @param message
*/
public StrolchPolicyException(String message) {
super(message);
}
public StrolchPolicyException(I18nMessage i18n) {
super(i18n.getMessage(Locale.getDefault()));
}
}