Class FxQuote


  • public class FxQuote
    extends java.lang.Object
    Author:
    Stijn Strickx
    • Constructor Summary

      Constructors 
      Constructor Description
      FxQuote​(java.lang.String symbol)  
      FxQuote​(java.lang.String symbol, java.math.BigDecimal price)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.math.BigDecimal getPrice()
      Returns the requested FX rate.
      java.math.BigDecimal getPrice​(boolean refresh)
      Returns the requested FX rate.
      java.lang.String getSymbol()  
      void setPrice​(java.math.BigDecimal price)  
      void setSymbol​(java.lang.String symbol)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FxQuote

        public FxQuote​(java.lang.String symbol)
      • FxQuote

        public FxQuote​(java.lang.String symbol,
                       java.math.BigDecimal price)
    • Method Detail

      • getSymbol

        public java.lang.String getSymbol()
      • setSymbol

        public void setSymbol​(java.lang.String symbol)
      • getPrice

        public java.math.BigDecimal getPrice()
        Returns the requested FX rate.
        Returns:
        the requested FX rate
      • getPrice

        public java.math.BigDecimal getPrice​(boolean refresh)
                                      throws java.io.IOException
        Returns the requested FX rate. This method will return 0 in the following situations:
        • the data hasn't been loaded yet in a previous request and refresh is set to false.
        • refresh is true and the data cannot be retrieved from Yahoo Finance for whatever reason (symbol not recognized, no network connection, ...)
        Parameters:
        refresh - indicates whether the data should be requested again to Yahoo Finance
        Returns:
        the requested FX rate
        Throws:
        java.io.IOException - when there's a connection problem
      • setPrice

        public void setPrice​(java.math.BigDecimal price)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object