APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.jpackage.internal.util

public Class LocalizedExceptionBuilder<T extends LocalizedExceptionBuilder<T>>

extends Object
Class Inheritance
Known Direct Subclasses
jdk.jpackage.internal.model.ConfigException.Builder
Type Parameters
<T>
Subclass extending LocalizedExceptionBuilder class.
Imports
java.util.function.BiFunction

Builder of exceptions with localized messages.

Field Summary

Modifier and TypeField and Description
private Throwable
private boolean
private final StringBundle
private String

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static LocalizedExceptionBuilder<?>

Returns:

the exception builder
buildLocalizedException
(StringBundle
the source of error messages
i18n
)

Creates an exception builder with the given source of error messages.

public final T

Returns:

this
cause
(Throwable
the cause. A null value is permitted, and indicates that the cause is nonexistent or unknown.
v
)

Sets the cause.

public final T

Returns:

this
causeAndMessage
(Throwable
the cause. Must not be null.
t
)

Sets the cause and the message.

public final <
the exception class
U extends Exception
>
U

Returns:

the exception
create
(BiFunction<String, Throwable, U>
the exception constructor
exceptionCtor
)

Creates an instance of type extending Exception class from the configured message and cause.

public final T

Returns:

this
format
(boolean
true if strings from the associated string bundle should be used as patterns for message formatting by this builder or false otherwise
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)

public final T

Returns:

this
message
(String
key of the string in the associated string bundle for the formatting pattern
msgId
,
Object...
the arguments for formatting message
args
)

Sets the message.

public final T

Returns:

this
noformat
()

A shortcut for format(false) call.

private T
thiz()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

causeback to summary
private Throwable cause
formatback to summary
private boolean format
i18nback to summary
private final StringBundle i18n
msgback to summary
private String msg

Constructor Detail

LocalizedExceptionBuilderback to summary
protected LocalizedExceptionBuilder(StringBundle i18n)

Method Detail

buildLocalizedExceptionback to summary
public static LocalizedExceptionBuilder<?> buildLocalizedException(StringBundle i18n)

Creates an exception builder with the given source of error messages.

Parameters
i18n:StringBundle

the source of error messages

Returns:LocalizedExceptionBuilder<?>

the exception builder

causeback to summary
public final T cause(Throwable v)

Sets the cause.

Parameters
v:Throwable

the cause. A null value is permitted, and indicates that the cause is nonexistent or unknown.

Returns:T

this

causeAndMessageback to summary
public final T causeAndMessage(Throwable t)

Sets the cause and the message. The message is copied from the given Throwable object as is.

Parameters
t:Throwable

the cause. Must not be null.

Returns:T

this

createback to summary
public final <U extends Exception> U create(BiFunction<String, Throwable, U> exceptionCtor)

Creates an instance of type extending Exception class from the configured message and cause.

Use message(String, Object...), causeAndMessage(Throwable), and cause(Throwable) methods to initialize message and/or cause.

Parameters
<U>
the exception class
exceptionCtor:BiFunction<String, Throwable, U>

the exception constructor

Returns:U

the exception

formatback to summary
public 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. Affects the behavior of the subsequent message(String, Object...) calls.

Parameters
v:boolean

true if strings from the associated string bundle should be used as patterns for message formatting by this builder or false otherwise

Returns:T

this

See Also
noformat()
formatStringback to summary
protected final String formatString(String keyId, Object... args)
messageback to summary
public final T message(String msgId, Object... args)

Sets the message.

Parameters
msgId:String

key of the string in the associated string bundle for the formatting pattern

args:Object[]

the arguments for formatting message

Returns:T

this

noformatback to summary
public final T noformat()

A shortcut for format(false) call.

Returns:T

this

See Also
format(boolean)
thizback to summary
private T thiz()
Annotations
@SuppressWarnings:unchecked