com.calitha.resource
Interface IXMLResourceBundle

All Known Implementing Classes:
XMLResourceBundle

public interface IXMLResourceBundle

Interface for resource bundles that support XML formats and can return IResource objects.

Author:
Robert van Loenhout
See Also:
XMLResourceBundle

Method Summary
 IResource getResource(String id)
          Requests a resource from the bundle.
 IResource getResource(String namespace, String id)
          Requests a resource from the bundle.
 String getText(String id)
          Requests the text content of a resource from the bundle.
 String getText(String namespace, String id)
          Requests the text content of a resource from the bundle.
 String getTextDefault(String id, String fallback)
          Requests the text content of a resource from the bundle.
 String getTextDefault(String namespace, String id, String fallback)
          Requests the text content of a resource from the bundle.
 

Method Detail

getResource

IResource getResource(String namespace,
                      String id)
Requests a resource from the bundle.

This method works similar as the getObject method, but casts the object to an IResource.

Parameters:
namespace - namespace
id - id
Returns:
resource object
Throws:
MissingResourceException - if no object for the given key can be found
IllegalArgumentException - if an argument is null
See Also:
ResourceBundle.getObject(java.lang.String)

getResource

IResource getResource(String id)
Requests a resource from the bundle.

This method always uses an empty namespace. This method works similar as the getObject method, but casts the object to an IResource.

Parameters:
id - id
Returns:
resource object
Throws:
MissingResourceException - if no object for the given key can be found
IllegalArgumentException - if an argument is null
See Also:
ResourceBundle.getObject(java.lang.String)

getText

String getText(String namespace,
               String id)
Requests the text content of a resource from the bundle.

Parameters:
namespace - namespace
id - id
Returns:
resource object
Throws:
MissingResourceException - if no object for the given key can be found
IllegalArgumentException - if an argument is null
See Also:
XMLResourceBundle.getResource(java.lang.String, java.lang.String)

getText

String getText(String id)
Requests the text content of a resource from the bundle.

This method always uses an empty namespace.

Parameters:
id - id
Returns:
resource object
Throws:
MissingResourceException - if no object for the given key can be found
IllegalArgumentException - if an argument is null
See Also:
XMLResourceBundle.getResource(java.lang.String, java.lang.String)

getTextDefault

String getTextDefault(String namespace,
                      String id,
                      String fallback)
Requests the text content of a resource from the bundle.

The default fallback string is returned if the resource cannot be found.

Parameters:
namespace - namespace
id - id
fallback - fallback text
Returns:
resource object
See Also:
XMLResourceBundle.getResource(java.lang.String, java.lang.String)

getTextDefault

String getTextDefault(String id,
                      String fallback)
Requests the text content of a resource from the bundle.

Always uses an empty namespace. The default fallback string is returned if the resource cannot be found.

Parameters:
id - id
fallback - fallback text
Returns:
resource object
Throws:
IllegalArgumentException - if an argument is null
See Also:
XMLResourceBundle.getResource(java.lang.String, java.lang.String)