task3/solution13/src/org/apidesign/apifest08/currency/ConversionNotSupportedException.java
1 package org.apidesign.apifest08.currency;
4 * Conversion not suported exception. This expecption may optionaly describe which conversion was required and failed.
5 * Required conversion can be found in {@link #getFromCurrecyCode() } and {@link #getToCurrecyCode() }.
7 * @author arnostvalicek
10 public class ConversionNotSupportedException extends ConvertorException {
15 public ConversionNotSupportedException() {
19 public ConversionNotSupportedException(String message) {
23 public ConversionNotSupportedException(String message, Throwable cause) {
24 super(message, cause);
27 public ConversionNotSupportedException(Throwable cause) {
32 * Create exception witd additional information about currencies which are not supported in coversion.
33 * @param from Code of source currency.
34 * @param to Code of target currency.
35 * @param twoWay Set to <code>false</code> if <em>From->To</em> is not supported.
36 * Set to <code>true</code> if both ways <em>From->To</em> and <em>To->From</em> conversions are not supported.
39 public ConversionNotSupportedException(String from, String to, boolean twoWay) {
46 public String toString() {
47 if (from!=null && to !=null) {
49 return "Neither onversion nor reverted conversion from " + from + " to " + to + " is not supported,";
51 return "Conversion from " + from + " to " + to + " is not supported,";
54 return super.toString();
59 * Returns code of source currency. This value may be null.
60 * @return Returns code of source currency.
62 public String getFromCurrecyCode() {
67 * Returns code of target currency. This value may be null.
68 * @return Returns code of target currency.
69 */ public String getToCurrecyCode() {
74 * Returns if one way of two way conversion is not supported.
76 * Value <code>false</code> means one way conversion is not supported. Value <code>true</code> means
77 * that two way conversio is not supported.
79 * @return Returs <code>false</code> for one way conversion, <code>true</code> for two way conversion.
81 public boolean getTwoWayConversion() {