Class LocalizedExceptionBuilder<T extends LocalizedExceptionBuilder<T>>
java.lang.Object
jdk.jpackage.internal.util.LocalizedExceptionBuilder<T>
- Type Parameters:
T- Subclass extendingLocalizedExceptionBuilderclass.
- 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 TSets the cause.final TSets the cause and the message.final <U extends Exception>
Ucreate(BiFunction<String, Throwable, U> exceptionCtor) Creates an instance of type extendingExceptionclass from the configured message and cause.final Tformat(boolean v) Configures this builder if strings from the associated string bundle should be used as patterns for message formatting or not.protected final StringformatString(String keyId, Object... args) final TSets the message.final Tnoformat()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 extendingExceptionclass 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-trueif strings from the associated string bundle should be used as patterns for message formatting by this builder orfalseotherwise- Returns:
- this
- See Also:
-
noformat
-
message
-
cause
-
causeAndMessage
-
formatString
-