| | |
| | | |
| | | |
| | | // Mapping from definition to locale-based resource bundle. |
| | | private final Map<AbstractManagedObjectDefinition, |
| | | private final Map<AbstractManagedObjectDefinition<?, ?>, |
| | | Map<Locale, ResourceBundle>> resources; |
| | | |
| | | |
| | |
| | | |
| | | // Private constructor. |
| | | private ManagedObjectDefinitionI18NResource(String prefix) { |
| | | this.resources = new HashMap<AbstractManagedObjectDefinition, |
| | | this.resources = new HashMap<AbstractManagedObjectDefinition<?, ?>, |
| | | Map<Locale, ResourceBundle>>(); |
| | | this.prefix = prefix; |
| | | } |
| | |
| | | * @throws MissingResourceException |
| | | * If the key was not found. |
| | | */ |
| | | public String getMessage(AbstractManagedObjectDefinition d, |
| | | public String getMessage(AbstractManagedObjectDefinition<?, ?> d, |
| | | String key) throws MissingResourceException { |
| | | return getMessage(d, key, Locale.getDefault(), (String[]) null); |
| | | } |
| | |
| | | * @throws MissingResourceException |
| | | * If the key was not found. |
| | | */ |
| | | public String getMessage(AbstractManagedObjectDefinition d, |
| | | public String getMessage(AbstractManagedObjectDefinition<?, ?> d, |
| | | String key, Locale locale) throws MissingResourceException { |
| | | return getMessage(d, key, locale, (String[]) null); |
| | | } |
| | |
| | | * @throws MissingResourceException |
| | | * If the key was not found. |
| | | */ |
| | | public String getMessage(AbstractManagedObjectDefinition d, |
| | | public String getMessage(AbstractManagedObjectDefinition<?, ?> d, |
| | | String key, Locale locale, String... args) |
| | | throws MissingResourceException { |
| | | ResourceBundle resource = getResourceBundle(d, locale); |
| | |
| | | * @throws MissingResourceException |
| | | * If the key was not found. |
| | | */ |
| | | public String getMessage(AbstractManagedObjectDefinition d, |
| | | public String getMessage(AbstractManagedObjectDefinition<?, ?> d, |
| | | String key, String... args) throws MissingResourceException { |
| | | return getMessage(d, key, Locale.getDefault(), args); |
| | | } |
| | |
| | | // Retrieve the resource bundle associated with a managed object and |
| | | // locale, lazily loading it if necessary. |
| | | private synchronized ResourceBundle getResourceBundle( |
| | | AbstractManagedObjectDefinition d, Locale locale) |
| | | AbstractManagedObjectDefinition<?, ?> d, Locale locale) |
| | | throws MissingResourceException { |
| | | // First get the locale-resource mapping, creating it if |
| | | // necessary. |