public interface ResourceResolver
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REF_KEY_END
"]"
|
static java.lang.String |
REF_KEY_START
"@["
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
formatResource(java.lang.String resource,
java.util.List<?> args)
Formats the given resource using supplied args to substitute placeholders.
|
java.lang.String |
formatResource(java.lang.String resource,
java.util.Map<java.lang.String,java.lang.Object> args)
Formats the given resource using supplied args to substitute placeholders.
|
java.lang.String |
formatResource(java.lang.String resource,
java.lang.Object[] args)
Formats the given resource using supplied args to substitute placeholders.
|
java.lang.Object |
resolveResource(java.lang.String key)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.util.List<?> args)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.util.List<?> args,
java.util.Locale locale)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.util.List<?> args,
java.util.Locale locale,
java.lang.Object defaultValue)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.util.List<?> args,
java.lang.Object defaultValue)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.util.Locale locale)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.util.Locale locale,
java.lang.Object defaultValue)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.util.Map<java.lang.String,java.lang.Object> args)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.util.Map<java.lang.String,java.lang.Object> args,
java.util.Locale locale)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.util.Map<java.lang.String,java.lang.Object> args,
java.util.Locale locale,
java.lang.Object defaultValue)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.util.Map<java.lang.String,java.lang.Object> args,
java.lang.Object defaultValue)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.lang.Object defaultValue)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.lang.Object[] args)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.lang.Object[] args,
java.util.Locale locale)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.lang.Object[] args,
java.util.Locale locale,
java.lang.Object defaultValue)
Try to resolve the resource.
|
java.lang.Object |
resolveResource(java.lang.String key,
java.lang.Object[] args,
java.lang.Object defaultValue)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.util.List<?> args,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.util.List<?> args,
java.util.Locale locale,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.util.List<?> args,
java.util.Locale locale,
T defaultValue,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.util.List<?> args,
T defaultValue,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.util.Locale locale,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.util.Locale locale,
T defaultValue,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.util.Map<java.lang.String,java.lang.Object> args,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.util.Map<java.lang.String,java.lang.Object> args,
java.util.Locale locale,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.util.Map<java.lang.String,java.lang.Object> args,
java.util.Locale locale,
T defaultValue,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.util.Map<java.lang.String,java.lang.Object> args,
T defaultValue,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.lang.Object[] args,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.lang.Object[] args,
java.util.Locale locale,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.lang.Object[] args,
java.util.Locale locale,
T defaultValue,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
java.lang.Object[] args,
T defaultValue,
java.lang.Class<T> type)
Try to resolve the resource.
|
<T> T |
resolveResourceConverted(java.lang.String key,
T defaultValue,
java.lang.Class<T> type)
Try to resolve the resource.
|
java.lang.Object |
resolveResourceValue(java.lang.String key,
java.util.Locale locale)
Resolve a resource given a key and a Locale.
|
static final java.lang.String REF_KEY_START
static final java.lang.String REF_KEY_END
@Nonnull java.lang.Object resolveResource(@Nonnull java.lang.String key) throws NoSuchResourceException
key
- Key to lookup, such as 'sample.SampleModel.icon'NoSuchResourceException
- if no resource is found@Nonnull java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.util.Locale locale) throws NoSuchResourceException
key
- Key to lookup, such as 'sample.SampleModel.icon'locale
- Locale in which to lookupNoSuchResourceException
- if no resource is found@Nonnull java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.lang.Object[] args) throws NoSuchResourceException
key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}" within a
resource, but this might differ between implementations), or null if none.NoSuchResourceException
- if no resource is found@Nonnull java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.lang.Object[] args, @Nonnull java.util.Locale locale) throws NoSuchResourceException
key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}" within a
resource, but this might differ between implementations), or null if none.locale
- Locale in which to lookupNoSuchResourceException
- if no resource is found@Nonnull java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.util.List<?> args) throws NoSuchResourceException
key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}" within a
resource, but this might differ between implementations), or null if none.NoSuchResourceException
- if no resource is found@Nonnull java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.util.List<?> args, @Nonnull java.util.Locale locale) throws NoSuchResourceException
key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}" within a
resource, but this might differ between implementations), or null if none.locale
- Locale in which to lookupNoSuchResourceException
- if no resource is found@Nullable java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nullable java.lang.Object defaultValue)
key
- Key to lookup, such as 'sample.SampleModel.icon'defaultValue
- Message to return if the lookup fails@Nullable java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.util.Locale locale, @Nullable java.lang.Object defaultValue)
key
- Key to lookup, such as 'sample.SampleModel.icon'locale
- Locale in which to lookupdefaultValue
- Message to return if the lookup fails@Nullable java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.lang.Object[] args, @Nullable java.lang.Object defaultValue)
key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}"
within a resource, but this might differ between implementations), or null if none.defaultValue
- Message to return if the lookup fails@Nullable java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.lang.Object[] args, @Nonnull java.util.Locale locale, @Nullable java.lang.Object defaultValue)
key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}"
within a resource, but this might differ between implementations), or null if none.locale
- Locale in which to lookupdefaultValue
- Message to return if the lookup fails@Nullable java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.util.List<?> args, @Nullable java.lang.Object defaultValue)
key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}"
within a resource, but this might differ between implementations), or null if none.defaultValue
- Message to return if the lookup fails@Nullable java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.util.List<?> args, @Nonnull java.util.Locale locale, @Nullable java.lang.Object defaultValue)
key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}"
within a resource, but this might differ between implementations), or null if none.locale
- Locale in which to lookupdefaultValue
- Message to return if the lookup fails@Nonnull java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.util.Map<java.lang.String,java.lang.Object> args) throws NoSuchResourceException
key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{:key}"
within a resource, but this might differ between implementations), or null if none.NoSuchResourceException
- if no resource is found@Nonnull java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.util.Map<java.lang.String,java.lang.Object> args, @Nonnull java.util.Locale locale) throws NoSuchResourceException
key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{:key}"
within a resource, but this might differ between implementations), or null if none.locale
- Locale in which to lookupNoSuchResourceException
- if no resource is found@Nullable java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.util.Map<java.lang.String,java.lang.Object> args, @Nullable java.lang.Object defaultValue)
key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{:key}"
within a resource, but this might differ between implementations), or null if none.defaultValue
- Message to return if the lookup fails@Nullable java.lang.Object resolveResource(@Nonnull java.lang.String key, @Nonnull java.util.Map<java.lang.String,java.lang.Object> args, @Nonnull java.util.Locale locale, @Nullable java.lang.Object defaultValue)
key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{:key}"
within a resource, but this might differ between implementations), or null if none.locale
- Locale in which to lookupdefaultValue
- Message to return if the lookup fails@Nonnull <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.lang.Class<T> type) throws NoSuchResourceException
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'type
- the type to be returnedNoSuchResourceException
- if no resource is found@Nonnull <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.util.Locale locale, @Nonnull java.lang.Class<T> type) throws NoSuchResourceException
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'locale
- Locale in which to lookuptype
- the type to be returnedNoSuchResourceException
- if no resource is found@Nonnull <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.lang.Object[] args, @Nonnull java.lang.Class<T> type) throws NoSuchResourceException
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}" within a
resource, but this might differ between implementations), or null if none.type
- the type to be returnedNoSuchResourceException
- if no resource is found@Nonnull <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.lang.Object[] args, @Nonnull java.util.Locale locale, @Nonnull java.lang.Class<T> type) throws NoSuchResourceException
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}" within a
resource, but this might differ between implementations), or null if none.locale
- Locale in which to lookuptype
- the type to be returnedNoSuchResourceException
- if no resource is found@Nonnull <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.util.List<?> args, @Nonnull java.lang.Class<T> type) throws NoSuchResourceException
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}" within a
resource, but this might differ between implementations), or null if none.type
- the type to be returnedNoSuchResourceException
- if no resource is found@Nonnull <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.util.List<?> args, @Nonnull java.util.Locale locale, @Nonnull java.lang.Class<T> type) throws NoSuchResourceException
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}" within a
resource, but this might differ between implementations), or null if none.locale
- Locale in which to lookuptype
- the type to be returnedNoSuchResourceException
- if no resource is found@Nullable <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nullable T defaultValue, @Nonnull java.lang.Class<T> type)
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'defaultValue
- Message to return if the lookup failstype
- the type to be returned@Nullable <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.util.Locale locale, @Nullable T defaultValue, @Nonnull java.lang.Class<T> type)
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'locale
- Locale in which to lookupdefaultValue
- Message to return if the lookup failstype
- the type to be returned@Nullable <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.lang.Object[] args, @Nullable T defaultValue, @Nonnull java.lang.Class<T> type)
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}"
within a resource, but this might differ between implementations), or null if none.defaultValue
- Message to return if the lookup failstype
- the type to be returned@Nullable <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.lang.Object[] args, @Nonnull java.util.Locale locale, @Nullable T defaultValue, @Nonnull java.lang.Class<T> type)
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}"
within a resource, but this might differ between implementations), or null if none.locale
- Locale in which to lookupdefaultValue
- Message to return if the lookup failstype
- the type to be returned@Nullable <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.util.List<?> args, @Nullable T defaultValue, @Nonnull java.lang.Class<T> type)
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}"
within a resource, but this might differ between implementations), or null if none.defaultValue
- Message to return if the lookup failstype
- the type to be returned@Nullable <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.util.List<?> args, @Nonnull java.util.Locale locale, @Nullable T defaultValue, @Nonnull java.lang.Class<T> type)
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{0}"
within a resource, but this might differ between implementations), or null if none.locale
- Locale in which to lookupdefaultValue
- Message to return if the lookup failstype
- the type to be returned@Nonnull <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.util.Map<java.lang.String,java.lang.Object> args, @Nonnull java.lang.Class<T> type) throws NoSuchResourceException
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{:key}"
within a resource, but this might differ between implementations), or null if none.type
- the type to be returnedNoSuchResourceException
- if no resource is found@Nonnull <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.util.Map<java.lang.String,java.lang.Object> args, @Nonnull java.util.Locale locale, @Nonnull java.lang.Class<T> type) throws NoSuchResourceException
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{:key}"
within a resource, but this might differ between implementations), or null if none.locale
- Locale in which to lookuptype
- the type to be returnedNoSuchResourceException
- if no resource is found@Nullable <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.util.Map<java.lang.String,java.lang.Object> args, @Nullable T defaultValue, @Nonnull java.lang.Class<T> type)
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{:key}"
within a resource, but this might differ between implementations), or null if none.defaultValue
- Message to return if the lookup failstype
- the type to be returned@Nullable <T> T resolveResourceConverted(@Nonnull java.lang.String key, @Nonnull java.util.Map<java.lang.String,java.lang.Object> args, @Nonnull java.util.Locale locale, @Nullable T defaultValue, @Nonnull java.lang.Class<T> type)
PropertyEditor
.key
- Key to lookup, such as 'sample.SampleModel.icon'args
- Arguments that will be filled in for params within the resource (params look like "{:key}"
within a resource, but this might differ between implementations), or null if none.locale
- Locale in which to lookupdefaultValue
- Message to return if the lookup failstype
- the type to be returned@Nonnull java.lang.Object resolveResourceValue(@Nonnull java.lang.String key, @Nonnull java.util.Locale locale) throws NoSuchResourceException
Resolve a resource given a key and a Locale.
This method should use the default Locale if the locale argument is null. The key
argument may refer to
another key if the resolved value results in a CharSequence
that begins with "@[" and ends with "]". In this
case the method will use the enclosed value as the next key to be resolved. For example, given the following key/value
definitions
some.key = Hello {0} other.key = @[some.key]Evaluating the keys results in
assert resolveResourceValue('some.key', Locale.default) == 'Hello {0}' assert resolveResourceValue('other.key', Locale.default) == 'Hello {0}'
key
- Key to lookup, such as 'sample.SampleModel.icon'locale
- Locale in which to lookupNoSuchResourceException
- if no message is found@Nonnull java.lang.String formatResource(@Nonnull java.lang.String resource, @Nonnull java.util.List<?> args)
resource
- The resource following a predefined format.args
- Arguments that will be filled in for params within the resource (params look like "{0}"
within a resource, but this might differ between implementations), or null if none.@Nonnull java.lang.String formatResource(@Nonnull java.lang.String resource, @Nonnull java.lang.Object[] args)
resource
- The resource following a predefined format.args
- Arguments that will be filled in for params within the resource (params look like "{0}"
within a resource, but this might differ between implementations), or null if none.@Nonnull java.lang.String formatResource(@Nonnull java.lang.String resource, @Nonnull java.util.Map<java.lang.String,java.lang.Object> args)
resource
- The resource following a predefined format.args
- Arguments that will be filled in for params within the resource (params look like "{:key}"
within a resource, but this might differ between implementations), or null if none.