public static class I18nRepository.ConfigBuilder extends ConfigBuilder
Config
instance that
is created by this builder. Configuration builder needs repository path and optional files pattern. Repository path
is a standard directories path but with ${locale} variable indicating locale directory position into directories
hierarchy, e.g. /var/www/vhosts/site/${locale}/emails/
. Directory path can be relative or absolute. If
files pattern is not provided accept all files.
For completeness here are the properties required by I18N repository.
Name | Type | Default | Description |
multi-locale | Boolean
| true | I18N repository is usually multiple locale; if single locale is desired set this property to false. |
base-dir | File
| null | Mandatory repository base directory, absolute or relative. Base directory contains locale directories as direct children. |
sub-path | String
| null | Optional sub-path following after locale directory. |
files-pattern | String
| WildcardFilter.ACCEPT_ALL | Pattern for the files to match. Should have format as accepted by WildcardFilter .
|
Modifier and Type | Field and Description |
---|---|
private String |
baseDir
Base directory for I18N repository.
|
private String |
filesPattern
Optional files pattern, default to null, in which case all files are accepted.
|
private static String |
LOCALE_VARIABLE
Locale variable present into repository directory path to mark sub-directory used for locale discriminate.
|
private boolean |
multiLocale
Support for multiple locale.
|
private String |
subpath
Optional sub-path following locale directory, default to null
|
Constructor and Description |
---|
ConfigBuilder(String repositoryPath,
String filesPattern)
Create configuration builder for given repository path and optional files pattern.
|
private static final String LOCALE_VARIABLE
private final boolean multiLocale
private final String baseDir
private final String subpath
private final String filesPattern
public ConfigBuilder(String repositoryPath, String filesPattern)
${locale}
and optional sub-path, e.g.
/var/www/vhosts/site/${locale}/emails/
.repositoryPath
- repository path,filesPattern
- optional files pattern, null if not used.IllegalArgumentException
- if repositoryPath
argument is null or empty, inferred base
directory does not exist or filesPattern
argument is empty.public Config build() throws ConfigException
ConfigBuilder
build
in class ConfigBuilder
ConfigException
- if XML stream read operation fails or is not well formed.Copyright © 2018. All rights reserved.