/** * Returns the <code>Dictionary</code> object associated with the given * name. * * @param name * @return specified dictionary * @throws MissingResourceException */ public static Dictionary getDictionary(String name) { Dictionary target = cache.get(name); if (target == null) { target = new Dictionary(name); cache.put(name, target); } return target; }
/** * The set of keys associated with this dictionary. * * @return the Dictionary set */ public Set<String> keySet() { HashSet<String> s = new HashSet<String>(); addKeys(s); return s; }
/** * Collection of values associated with this dictionary. * * @return the values */ public Collection<String> values() { ArrayList<String> s = new ArrayList<String>(); addValues(s); return s; }
private static String getDictionaryEntry(String dictionaryName, String key) { try { Dictionary dic = Dictionary.getDictionary(dictionaryName); if (dic != null) { return dic.get(key); } return null; } catch (Exception e) { return null; } }
private String getString(String key) { try { return _dictionary.get(key); } catch (MissingResourceException e) { return null; } }
public DictionaryClientConfig() { _dictionary = Dictionary.getDictionary("dq_monitor_client_config"); }
private static Set<String> getDictionaryKeys(String dictionaryName) { Dictionary dic = Dictionary.getDictionary(dictionaryName); if (dic != null) { return dic.keySet(); } return null; }
void resourceError(String key) { String error = "Cannot find '" + key + "' in " + this; throw new MissingResourceException(error, this.toString(), key); }
/** * Constructor for <code>Dictionary</code>. * * @param name name of linked JavaScript Object */ private Dictionary(String name) { if (name == null || "".equals(name)) { throw new IllegalArgumentException( "Cannot create a Dictionary with a null or empty name"); } this.label = "Dictionary " + name; attach(name); if (dict == null) { throw new MissingResourceException( "Cannot find JavaScript object with the name '" + name + "'", name, null); } }
/** * @return null if no bundle, ???key??? if bundle is missing a key */ public String getLocalizedKey( String key ) { if ( mDictionaryName == null ) { return null; } try { if ( mDictionary == null ) { mDictionary = Dictionary.getDictionary( mDictionaryName ); } return mDictionary.get( key ); } catch ( MissingResourceException e ) { return StringUtils.RESOURCE_KEY_NOT_FOUND_PREFIX + key + StringUtils.RESOURCE_KEY_NOT_FOUND_SUFFIX; } }
/** * @return the git commit id of the loaded version */ public static String getCommitId() { return DICTIONARY.get("commitId"); }
public BaseDynamicMessages() { this(Dictionary.getDictionary(MESSAGES_DICTIONARY_NAME)); }
void resourceError(String key) { String error = "Cannot find '" + key + "' in " + this; throw new MissingResourceException(error, this.toString(), key); }
/** * Constructor for <code>Dictionary</code>. * * @param name name of linked JavaScript Object */ private Dictionary(String name) { if (name == null || "".equals(name)) { throw new IllegalArgumentException( "Cannot create a Dictionary with a null or empty name"); } this.label = "Dictionary " + name; attach(name); if (dict == null) { throw new MissingResourceException( "Cannot find JavaScript object with the name '" + name + "'", name, null); } }
/** * To be used in Sonar extensions only, else use constructors. */ public static Sonar getInstance() { if (instance == null) { Dictionary dic = Dictionary.getDictionary("config"); instance = new Sonar(dic.get("sonar_url")); } return instance; }
/** * @return the display name of the loaded version (e.g. "2.5.6") */ public static String getVersion() { return DICTIONARY.get("version"); }
public final void addDictionaryEntries(String dictionaryName, Map<String, String> entries) { Dictionary dictionary = Dictionary.getDictionary(dictionaryName); DictionaryUtils.addEntries(dictionary, entries); }
/** * The set of keys associated with this dictionary. * * @return the Dictionary set */ public Set<String> keySet() { HashSet<String> s = new HashSet<String>(); addKeys(s); return s; }
/** * Collection of values associated with this dictionary. * * @return the values */ public Collection<String> values() { ArrayList<String> s = new ArrayList<String>(); addValues(s); return s; }
void resourceError(String key) { String error = "Cannot find '" + key + "' in " + this; throw new MissingResourceException(error, this.toString(), key); }