ch.elca.el4j.util.codelist
Class CodelistUtility

java.lang.Object
  extended by ch.elca.el4j.util.codelist.CodelistUtility

public class CodelistUtility
extends Object

This class implements the base functionality for enums which represent codelists and implement the Interface Codelist. Since the extensibility of enum types is not supported by the language construct, the functional implementation is provided in this utility class.

Author:
Jonas Hauenstein (JHN)
File-location:
CodelistUtility
Last check-in date:
2009-12-01 12:19:40 +0100 (Di, 01. Dez 2009) by jonasha for revision 4014

Constructor Summary
CodelistUtility(String resourceBaseName)
          Constructor.
 
Method Summary
static List<Locale> getAvailableLocales(String resourceBaseName)
          Returns a list of all java locales for which a .properties file corresponding to the ResourceBundle base name is available.
 List<Locale> getLocales()
          Returns a list of all java locales for which a translation of the textual description is available.
 String loadLongText(String code, Locale lang)
          Getter for the long textual description of the code in a given language.
 String loadShortText(String code, Locale lang)
          Getter for the short textual description of the code in a given language.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodelistUtility

public CodelistUtility(String resourceBaseName)
Constructor.

Parameters:
resourceBaseName - Base name of the associated ResourceBundle
Method Detail

loadShortText

public String loadShortText(String code,
                            Locale lang)
Getter for the short textual description of the code in a given language. This method returns the String with the property suffix ".short".

Parameters:
code - Code for which the text is loaded
lang - Java Locale of the desired language for the returned text
Returns:
The short textual description of the code

loadLongText

public String loadLongText(String code,
                           Locale lang)
Getter for the long textual description of the code in a given language. This method returns the String with the property suffix ".long".

Parameters:
code - Code for which the text is loaded
lang - Java Locale of the desired language for the returned text
Returns:
The long textual description of the code

getLocales

public List<Locale> getLocales()
Returns a list of all java locales for which a translation of the textual description is available. Returns an empty list if no translations were found.

Returns:
List of java locales

getAvailableLocales

public static List<Locale> getAvailableLocales(String resourceBaseName)
Returns a list of all java locales for which a .properties file corresponding to the ResourceBundle base name is available. Returns an empty list if no .properties files were found for the given base name.

Parameters:
resourceBaseName - Base name of the ResourceBundle
Returns:
List of java locales


Copyright © 2005-2011 ELCA. All Rights Reserved.