Package dev.orne.i18n
Class I18nResourcesString.Builder
java.lang.Object
dev.orne.i18n.I18nResourcesString.Builder
- Enclosing class:
- I18nResourcesString
Builder of
I18nResourcesString
instances.- Since:
- 0.1
- Version:
- 1.0, 2021-01
- Author:
- (w) Iker Hernaez
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds aI18nResourcesString
with the configured properties.boolean
protected List<Serializable>
Returns the text arguments, applied to resolved or default text.getCodes()
Returns the I18N text codes, in order of priority.protected String
Returns the default text.protected String
Returns the key of the I18N resources to use.int
hashCode()
ofResources
(String key) Sets the I18N resources to use.withArg
(Serializable arg) Adds the specified argument to the text arguments of this builder.withArgs
(Serializable... args) Adds the specified arguments to the text arguments of this builder.Appends the specified text code to the codes configured of this builder.Appends the specified text codes to the codes configured of this builder.
-
Constructor Details
-
Builder
Creates a newI18nResourcesString
builder with the specified default text.- Parameters:
defaultText
- The default text
-
-
Method Details
-
ofResources
Sets the I18N resources to use. Ifnull
will use default ones.- Parameters:
key
- The I18N resources to use- Returns:
- This builder for method chaining
-
withCode
Appends the specified text code to the codes configured of this builder.- Parameters:
code
- The I18N text code- Returns:
- This builder for method chaining
-
withCodes
Appends the specified text codes to the codes configured of this builder. Nonull
codes are allowed.- Parameters:
codes
- The I18N text codes, in order of priority- Returns:
- This builder for method chaining
-
withArg
Adds the specified argument to the text arguments of this builder.- Parameters:
arg
- The text argument, applied to resolved or default text- Returns:
- This builder for method chaining
-
withArgs
Adds the specified arguments to the text arguments of this builder.- Parameters:
args
- The text arguments, applied to resolved text or default text- Returns:
- This builder for method chaining
-
getI18nResourcesKey
Returns the key of the I18N resources to use.- Returns:
- The key of the I18N resources to use
-
getDefaultText
Returns the default text.- Returns:
- The default text
-
getCodes
Returns the I18N text codes, in order of priority.- Returns:
- The I18N text codes, in order of priority
-
getArguments
Returns the text arguments, applied to resolved or default text.- Returns:
- The text arguments
-
hashCode
public int hashCode() -
equals
-
build
Builds aI18nResourcesString
with the configured properties. Validates that the default text and that at least one text code are set.- Returns:
- The
I18nResourcesString
with the configured properties
-