public class LangProperties extends JProperties
| Modifier and Type | Field and Description | 
|---|---|
protected java.lang.String | 
defaultLangPrefix  | 
protected java.util.List<java.lang.String> | 
localizedLangList  | 
static java.lang.String | 
REVISION  | 
listenerSet, PREFIX_PROPERTIES_CACHE_MAX_ENTRIES, prefixPropertiesCache, propertyNameAsDefaultValue, SENSITIVE_KEYWORD| Constructor and Description | 
|---|
LangProperties()  | 
| Modifier and Type | Method and Description | 
|---|---|
java.lang.String | 
format(java.lang.String format,
      java.lang.Object[] objects)
This is a temporary implementation waiting for a more powerful Format. 
 | 
java.lang.String | 
format(java.lang.String format,
      java.lang.Object[] objects,
      java.lang.String language)
This is a temporary implementation waiting for a more powerful Format. 
 | 
java.lang.String | 
getExplicitLangProperty(LangProperty prop,
                       java.lang.String language)
Resolve the given property name using the given language. 
 | 
java.lang.String | 
getExplicitLangProperty(java.lang.String name,
                       java.lang.String language,
                       java.util.Map<java.lang.String,java.lang.String> paramMap)
Resolve the given property name using the given language. 
 | 
java.lang.String | 
getExplicitLangProperty(java.lang.String name,
                       java.lang.String language,
                       java.lang.Object[] formArgs)
Resolve the given property name using the given language. 
 | 
java.lang.String | 
getLangProperty(java.lang.String name,
               java.lang.Object... formArgs)
Resolve the given property name using the default language prefix. 
 | 
java.lang.String[] | 
getLangStringArrayProperty(java.lang.String name,
                          java.lang.String[] defaultValue)  | 
JProperties | 
getProperties(java.lang.String prefix)
Returns a new property set of properties with key matching a
 given prefix. 
 | 
java.lang.Exception | 
popLastFormatException()
Retrieve and clear the last Exception which occured while trying to formatting. 
 | 
V | 
put(K key,
   V value)  | 
void | 
setDefaultLangPrefix(java.lang.String langPrefix)
Define the default lang prefix to use when looking for a language property. 
 | 
void | 
setLocalizedLanguageList(java.util.List<java.lang.String> langList)
Set a list of languages in which this properties are localized. 
 | 
addProperties, addProperties, addPropertiesListener, buildArrayFromString, checkCacheGetProperties, clearProperties, containsProperty, firePropertiesChange, getBooleanProperty, getDoubleProperty, getFloatProperty, getIntArrayProperty, getIntegerProperty, getListenerSet, getLongProperty, getProperty, getProperty, getStringArrayProperty, getSubProperties, invalidateCacheGetProperties, load, load, load, load, putCacheGetProperties, removePropertiesListener, setProperty, updateAndSaveclear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, valuespublic static final java.lang.String REVISION
protected java.lang.String defaultLangPrefix
protected java.util.List<java.lang.String> localizedLangList
public void setDefaultLangPrefix(java.lang.String langPrefix)
langPrefix - an ISO-639 language code (without any '.')public void setLocalizedLanguageList(java.util.List<java.lang.String> langList)
This list is used as a fallback when a property could not be found in the default language
langList - a List of ISO-639 language code.public java.lang.String getLangProperty(java.lang.String name,
                                        java.lang.Object... formArgs)
name - the property name to resolveformArgs - an array of parameters to use to for the format of propertypublic java.lang.String getExplicitLangProperty(LangProperty prop, java.lang.String language)
prop - the LangProperty instance corresponding to the property you want to resolve.language - the ISO-639 code language to use to retrieve this propertypublic java.lang.String getExplicitLangProperty(java.lang.String name,
                                                java.lang.String language,
                                                java.lang.Object[] formArgs)
Example :
  String i18nStr = getExplicitLangProperty("ui.com.lbl.byte", "en", 6);
 name - the property name to resolvelanguage - the language prefix used before the property name, usually an ISO-639
        language code, if null, the default lang prefix is used.formArgs - an array of parameters to use to for the format of propertypublic java.lang.String getExplicitLangProperty(java.lang.String name,
                                                java.lang.String language,
                                                java.util.Map<java.lang.String,java.lang.String> paramMap)
Example :
  
  Map<String,String> paramMap = new HashMap<String,String>();
  paramMap.put("firstName", "John");
  paramMap.put("lastName", "Doe");
  String i18nStr = getExplicitLangProperty("my.property", "en", paramMap);
  
 
 with the given property:
 
 my.property: Hello {firstName} {lastName}
 name - the property name to resolvelanguage - the language prefix used before the property name, usually an ISO-639
        language code, if null, the default lang prefix is used.paramMap - the map of parameterspublic java.lang.String[] getLangStringArrayProperty(java.lang.String name,
                                                     java.lang.String[] defaultValue)
public JProperties getProperties(java.lang.String prefix)
getProperties in class JPropertiesprefix - the prefix the properties must match to be added to the
        return LangProperties instance, if null, all properties are added.public java.lang.String format(java.lang.String format,
                               java.lang.Object[] objects)
format - the string containing the pattern to be replacedobjects - an array of objects to be formatted and substituted.public java.lang.String format(java.lang.String format,
                               java.lang.Object[] objects,
                               java.lang.String language)
format - the string containing the pattern to be replacedobjects - an array of objects to be formatted and substituted.language - the language in which the string is being renderrd, used for recursive property such as "Hello {some.other.property}! "public java.lang.Exception popLastFormatException()
This method is not thread safe and is only meant to be used for testing purpose
public V put(K key,
             V value)
put in interface java.util.Map<K,V>put in class java.util.Hashtable<K,V>Copyright © 2001-2018 Jalios SA. All Rights Reserved.