|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.webmethods.caf.faces.data.object.ResourceBundleContentProvider
public class ResourceBundleContentProvider
Adapts a ResourceBundle
to an IContentProvider
.
Emulates behaviour of f:loadBundle tag, generating "???key???" for the value of a missing resources.
Used internally by BaseFacesPreferencesBean.getPortletResources()
and BaseApplicationBean.getApplicationResources()
.
ResourceBundle rb = new ListResourceBundle { protected Object[][] getContents() { return new Object[][]{ {"company.name", "webMethods"}, } }; IContentProvider provider = new ResourceBundleContentProvider(rb); String contactName = provider.getValue("company.name"); // returns "webMethods"
Field Summary | |
---|---|
protected ResourceBundle |
m_bundle
|
Constructor Summary | |
---|---|
ResourceBundleContentProvider()
Default constructor. |
|
ResourceBundleContentProvider(ResourceBundle bundle)
Initializes provider with the given resource bundle. |
Method Summary | |
---|---|
Object[] |
getPropertyKeys()
Returns keys in the resource bundle |
ResourceBundle |
getResourceBundle()
Returns wrapped resource bundle |
Class |
getType(Object propertyKey)
Returns java type of the given property |
Object |
getValue(Object propertyKey)
Returns the value from the resource bundle for the given key |
Object |
getValue(Object propertyKey,
Object[] args)
Returns the value from the resource bundle for the given key |
boolean |
hasProperty(Object propertyKey)
Always return true . |
void |
setResourceBundle(ResourceBundle bundle)
Sets resource bundle to wrap |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.webmethods.caf.faces.data.IContentProvider |
---|
toString |
Field Detail |
---|
protected ResourceBundle m_bundle
Constructor Detail |
---|
public ResourceBundleContentProvider()
ResourceBundleContentProvider.setResourceBundle(ResourceBundle)
must be called before use.
public ResourceBundleContentProvider(ResourceBundle bundle)
bundle
- resource bundleMethod Detail |
---|
public Object getValue(Object propertyKey) throws EvaluationException, PropertyNotFoundException
getValue
in interface IContentProvider
propertyKey
- the key to lookup the value in the resource bundle
EvaluationException
- if error during property evaluation
PropertyNotFoundException
- if property is not supportedpublic Object getValue(Object propertyKey, Object[] args) throws EvaluationException, PropertyNotFoundException
propertyKey
- the key to lookup the value in the resource bundleargs
- the object array contains string substitution values
EvaluationException
PropertyNotFoundException
public Class getType(Object propertyKey) throws PropertyNotFoundException
IContentProvider
getType
in interface IContentProvider
propertyKey
- the property key of type String
or Integer
Class
PropertyNotFoundException
- if property is not supportedpublic Object[] getPropertyKeys()
getPropertyKeys
in interface IContentProvider
public boolean hasProperty(Object propertyKey)
true
.
hasProperty
in interface IContentProvider
propertyKey
- property key of type String
or Integer
true
if property is supportedpublic ResourceBundle getResourceBundle()
public void setResourceBundle(ResourceBundle bundle)
bundle
- resource bundle, must not be null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |