Interface CurrencyFormattingSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession

public interface CurrencyFormattingSession extends OsidSession

This session defines methods to format and parse currency amounts.

  • Method Details

    • getCurrencyType

      Type getCurrencyType()
      Gets the currency type for amounts used in this session.
      Returns:
      the currency type
      Compliance:
      mandatory - This method must be implemented.
    • getNumericFormatType

      Type getNumericFormatType()
      Gets the numeric format type for the amounts used in this session.
      Returns:
      the numeric format type
      Compliance:
      mandatory - This method must be implemented.
    • canFormatCurrencies

      boolean canFormatCurrencies()
      Tests if this user can format and parse currencies. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer lookup operations.
      Returns:
      false if translation methods are not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • currencyToString

      Gets a string representation of a currency including the currency symbol indicated by the currency type.
      Parameters:
      amount - a currency value
      Returns:
      the display string
      Throws:
      InvalidArgumentException - amount.getCurrencyType() != getCurrencyType()
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • currenciesToStrings

      String[] currenciesToStrings(Currency[] amounts) throws OperationFailedException, PermissionDeniedException
      Gets a string representation of a list of currency amounts including the currency symbols indicated by the currency type.
      Parameters:
      amounts - an array of amounts
      Returns:
      the display strings
      Throws:
      InvalidArgumentException - amount.getCurrencyType() != getCurrencyType()
      NullArgumentException - amounts is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • stringToCurrency

      Parses a currency amount.
      Parameters:
      s - a currency string
      Returns:
      the currency amount
      Throws:
      InvalidArgumentException - s is not of getCurrencyType() or s is not of getNumericFormatType()
      NullArgumentException - s is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.