A codeset is an XML file containing codes and descriptions in multiple languages. To load a codset, a simple url pointing to a valid codeset xml is enough. If you want to implement your own strategy or caching mechanism how to load and where to load the codeset from (i.e. fetch from DB, etc.), just implement the CodeSet interface.

See class com.jaxfront.demo.api.OwnCodeSetResolverImpl


public class OwnCodeSetResolverImpl implements CodeSet { 
public Reader getCodeSet(Type type, String codeSetName, String versionNo) { 
//for demo purposes, load the codeset file from local jar/file system
String fileName = "examples/purchaseOrder/po.codes";
URL codeSetURL = URLHelper.getUserURL(fileName);
try {
if (codeSetURL != null) {
String xmlContent = FileHelper.readFileAsString(codeSetURL);
return new StringReader(xmlContent);
}
}
catch (IOException ex) {
LogRegistry.getInstance().warn(getClass(), "Unable to open file: " + fileName);
}
return null;
}
} 



  • Keine Stichwörter