|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.unitesk.atp.text.localize.ConstantStringManager
public class ConstantStringManager
The default implementation of localized strings manager. Associates object classes and bundles of localized messages. That is for all objects of some class localized strings with the same names are equal.
Field Summary | |
---|---|
protected Map |
class_to_bundle
|
protected ClassLoader |
classLoader
|
protected Locale |
locale
|
Constructor Summary | |
---|---|
ConstantStringManager()
Creates new localized strings manager using default locale and class loader of this class. |
|
ConstantStringManager(Locale locale)
Creates new localized strings manager using the specified locale and class loader of this class. |
|
ConstantStringManager(Locale locale,
ClassLoader classLoader)
Creates new localized strings manager with the specified locale and class loader. |
Method Summary | |
---|---|
protected ResourceBundle |
getBundle(Class cls)
Loads bundle of localized strings for the specified class. |
String |
getString(Class cls,
String name)
Get localized string for the specified class. |
String |
getString(Class cls,
String name,
Object obj)
Get localized string for the specified class and customize it for the specified object. |
String |
getString(String name,
Object obj)
Get localized string for the specified object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Locale locale
protected ClassLoader classLoader
protected Map class_to_bundle
Constructor Detail |
---|
public ConstantStringManager()
public ConstantStringManager(Locale locale)
locale
- The locale to be used by this manager.public ConstantStringManager(Locale locale, ClassLoader classLoader)
locale
- The locale to be used by this manager.classLoader
- The class loader to be used by this maanger.Method Detail |
---|
protected ResourceBundle getBundle(Class cls)
This implementation uses
ResourceBundle.getBundle( cls.getName(), locale, classLoader)
to obtain bundle. locale
and classLoader
are specified in constructor of this manager.
Inheritors can override this method to change a way of bundle loading.
cls
- The specified class.
null
if it is not found.public String getString(Class cls, String name)
getBundle( cls )
to obtain resource bundle.
Then gets string
name
from this bundle
and customize it with respect to obj
.
getString
in interface StringManager
cls
- The specified class.name
- The name of localized string for this class.
null
if it is not found.public String getString(String name, Object obj)
getString( obj.getClass(), name )
.
This string manager is called 'constant' because it returns the same string
for all objects of the same class.
getString
in interface StringManager
name
- The name of localized string for this object.obj
- The specified object.
null
if it is not found.public String getString(Class cls, String name, Object obj)
getString( cls, name )
.
This string manager is called 'constant' because it returns the same string
for all objects of the same class.
getString
in interface StringManager
cls
- The specified class.name
- The name of localized string for this class.obj
- Not used.
null
if it is not found.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |