|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.fikin.pojostate.select.AbstractSelector
net.sf.fikin.pojostate.select.ResourceBundleSelector
public class ResourceBundleSelector
Resource bundle based methods selector.
It recognizes only those methods which are found in the resource bundle.
If any of the following definitions is present the method is recognized as observable:
If ".name" is not present it will print the method's name.
If ".desc" is not present it will print null for method description.
If ".format" is not present it will use DefaultFormat.
Example:
created on Mar 1, 2007
...
<package.class.method>.name=<UI name>
<package.class.method>.desc=<UI description>
<package.class.method>.format=<format class>[:<format pattern>]
...
| Constructor Summary | |
|---|---|
ResourceBundleSelector()
|
|
| Method Summary | |
|---|---|
protected java.lang.String |
createMethodKey(java.lang.Class clazz,
java.lang.reflect.Method method)
construct method's base name as it will be used in the resource bundle definitions. |
java.lang.String |
getBaseName()
|
protected java.util.WeakHashMap |
getCachedRB()
|
MethodsIterator |
getMethodsIterator()
|
protected java.lang.String |
getRBKey(java.util.Locale locale)
create a string key, uniquely identifying the resource bundle of this locale handle empty locale settings too |
protected boolean |
isApplicable(java.lang.Class clazz,
java.lang.reflect.Method method,
java.util.Locale locale,
java.lang.ClassLoader loader)
looks for the bundle with given local and base name then looks for if the method having ".name", ".desc" and ".format" resource definitions. |
protected java.util.ResourceBundle |
loadRB(java.util.Locale locale,
java.lang.ClassLoader loader)
attempt to load the resource bundle with given base name and locale |
protected java.util.ResourceBundle |
lookupCachedRB(java.lang.String rbKey)
lookup the cache for already loaded resource bundle for that locale |
protected MethodMeta |
newMethodMeta(java.lang.Class clazz,
java.lang.reflect.Method method,
java.util.Locale locale,
java.lang.ClassLoader loader)
return existing tempObj as it has been already initialized
by isApplicable(Class, Method, Locale, ClassLoader). |
protected void |
putInRBCache(java.lang.String rbkey,
java.util.ResourceBundle bundle)
put in the resource bundle cache given bundle under given key |
protected ExplicitMethodMeta |
resolveEntry(java.util.ResourceBundle bundle,
java.lang.Class clazz,
java.lang.reflect.Method method,
java.util.Locale locale,
java.lang.ClassLoader loader)
Use the methods iterator to find a matching resource entry for that given method by doing deep class-hierarchy scanning. |
void |
setBaseName(java.lang.String baseName)
set associated resource bundle |
void |
setMethodsIterator(MethodsIterator iterator)
set method's definitions iterator |
| Methods inherited from class net.sf.fikin.pojostate.select.AbstractSelector |
|---|
getMethodMeta |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ResourceBundleSelector()
| Method Detail |
|---|
public void setBaseName(java.lang.String baseName)
baseName - of the resource bundle, different locales will be
appended to this name.public java.lang.String getBaseName()
public void setMethodsIterator(MethodsIterator iterator)
iterator - public MethodsIterator getMethodsIterator()
protected java.util.WeakHashMap getCachedRB()
protected boolean isApplicable(java.lang.Class clazz,
java.lang.reflect.Method method,
java.util.Locale locale,
java.lang.ClassLoader loader)
then looks for if the method having ".name", ".desc" and ".format" resource definitions.
If such found returns true, otherwise false.
isApplicable in class AbstractSelectorclazz - is POJO's classmethod - is some of the clazz methods, currently being tested
if it is to be observedlocale - to be used when creating the metadataloader - is the classloader to be used to load any resource
file (if required)
protected MethodMeta newMethodMeta(java.lang.Class clazz,
java.lang.reflect.Method method,
java.util.Locale locale,
java.lang.ClassLoader loader)
tempObj as it has been already initialized
by isApplicable(Class, Method, Locale, ClassLoader).
newMethodMeta in class AbstractSelectorclazz - is POJO's classmethod - to be includedlocale - to be used when creating the metadataloader - is the classloader to be used to load any resource
file (if required)
MethodMeta object
protected ExplicitMethodMeta resolveEntry(java.util.ResourceBundle bundle,
java.lang.Class clazz,
java.lang.reflect.Method method,
java.util.Locale locale,
java.lang.ClassLoader loader)
throws java.util.MissingResourceException
Use the methods iterator to find a matching resource entry for that given method by doing deep class-hierarchy scanning.
bundle - clazz - method - loader -
DecorationException - in case of internal error
java.util.MissingResourceException
protected java.lang.String createMethodKey(java.lang.Class clazz,
java.lang.reflect.Method method)
format is like "fqClassName.methodName"
clazz - method -
protected java.lang.String getRBKey(java.util.Locale locale)
handle empty locale settings too
locale -
protected java.util.ResourceBundle lookupCachedRB(java.lang.String rbKey)
rbKey -
protected java.util.ResourceBundle loadRB(java.util.Locale locale,
java.lang.ClassLoader loader)
locale - loader -
protected void putInRBCache(java.lang.String rbkey,
java.util.ResourceBundle bundle)
rbkey - bundle -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||