コード例 #1
0
 public boolean preloadCurrencies() {
   try {
     logger.log(Level.INFO, "Preloading currencies");
     ServerLoader loader = new ServerLoader();
     ServerLoader.Response r = loader.read("CurrenciesAPI", "getAll");
     if (r.getStatus().equals(ServerLoader.Response.STATUS_OK)) {
       JSONArray a = r.getArrayContent();
       List<CurrencyInfo> currencies = new ArrayList<CurrencyInfo>();
       for (int i = 0; i < a.length(); i++) {
         JSONObject o = a.getJSONObject(i);
         CurrencyInfo currency = new CurrencyInfo(o);
         currencies.add(currency);
       }
       CurrenciesCache.refreshCurrencies(currencies);
       return true;
     } else {
       return false;
     }
   } catch (Exception e) {
     e.printStackTrace();
     return false;
   }
 }
コード例 #2
0
 public CurrencyInfo getMainCurrency() throws BasicException {
   return CurrenciesCache.getMainCurrency();
 }
コード例 #3
0
 public CurrencyInfo getCurrency(int currencyId) throws BasicException {
   return CurrenciesCache.getCurrency(currencyId);
 }
コード例 #4
0
 public final List<CurrencyInfo> getCurrenciesList() throws BasicException {
   return CurrenciesCache.getCurrencies();
 }