Class LocalizedExceptionBuilder<T extends LocalizedExceptionBuilder<T>>
java.lang.Object
jdk.jpackage.internal.util.LocalizedExceptionBuilder<T>
- Type Parameters:
T
- Subclass extendingLocalizedExceptionBuilder
class.
- Direct Known Subclasses:
ConfigException.Builder
Builder of exceptions with localized messages.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LocalizedExceptionBuilder
<?> Creates an exception builder with the given source of error messages.final T
Sets the cause.final T
Sets the cause and the message.final <U extends Exception>
Ucreate
(BiFunction<String, Throwable, U> exceptionCtor) Creates an instance of type extendingException
class from the configured message and cause.final T
format
(boolean v) Configures this builder if strings from the associated string bundle should be used as patterns for message formatting or not.protected final String
formatString
(String keyId, Object... args) final T
Sets the message.final T
noformat()
A shortcut forformat(false)
call.
-
Constructor Details
-
LocalizedExceptionBuilder
-
-
Method Details
-
buildLocalizedException
Creates an exception builder with the given source of error messages.- Parameters:
i18n
- the source of error messages- Returns:
- the exception builder
-
create
Creates an instance of type extendingException
class from the configured message and cause.Use
message(String, Object...)
,causeAndMessage(Throwable)
, andcause(Throwable)
methods to initialize message and/or cause.- Type Parameters:
U
- the exception class- Parameters:
exceptionCtor
- the exception constructor- Returns:
- the exception
-
format
Configures this builder if strings from the associated string bundle should be used as patterns for message formatting or not. Affects the behavior of the subsequentmessage(String, Object...)
calls.- Parameters:
v
-true
if strings from the associated string bundle should be used as patterns for message formatting by this builder orfalse
otherwise- Returns:
- this
- See Also:
-
noformat
-
message
-
cause
-
causeAndMessage
-
formatString
-