Skip to content

Instantly share code, notes, and snippets.

@javaeeeee
Created December 4, 2015 06:56
Show Gist options
  • Select an option

  • Save javaeeeee/36597f9242cdbe887d6c to your computer and use it in GitHub Desktop.

Select an option

Save javaeeeee/36597f9242cdbe887d6c to your computer and use it in GitHub Desktop.
A representation class to communicate to Open Exchange Rates API
public class CurrencyData {
/**
* A string with a disclaimer.
*/
private String disclaimer;
/**
* A string with a license.
*/
private String license;
/**
* A timestamp.
*/
private long timestamp;
/**
* The currency relative to which exchange rates are returned. In a free
* version of the API one cannot change the base and it is US Dollar by
* default.
*/
private String base;
/**
* A map with exchange rate with keys like USD for US Dollar, EUR for Euro,
* CAD for Canadian Dollar etc.
*/
private Map<String, Double> rates = new HashMap<>();
/**
* A no-argument constructor.
*/
public CurrencyData() {
}
/**
* A constructor needed for testing.
*
* @param disclaimer A string with a disclaimer.
* @param license A string with a license.
* @param timestamp A timestamp.
* @param base The currency relative to which exchange rates are returned.
*/
public CurrencyData(String disclaimer, String license, long timestamp, String base) {
this.disclaimer = disclaimer;
this.license = license;
this.timestamp = timestamp;
this.base = base;
}
//Getters and setters.
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment