1 // © 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 3 /* 4 ******************************************************************************* 5 * Copyright (C) 2012, International Business Machines Corporation and * 6 * others. All Rights Reserved. * 7 ******************************************************************************* 8 */ 9 package com.ibm.icu.dev.tool.currency; 10 11 /** 12 * Currency data entry corresponding to the XML data distributed by SIX Interbank Clearing 13 * (The ISO 4217 maintenance agency). 14 */ 15 public class CurrencyDataEntry { 16 private String entity; 17 private String currency; 18 private String alphabeticCode; 19 private Integer numericCode; 20 private Integer minorUnit; 21 private String withdrawalDate; 22 private String remark; 23 private boolean historic; 24 CurrencyDataEntry(String entity, String currency, String alphabeticCode, Integer numericCode, Integer minorUnit, String withdrawalDate, String remark, boolean historic)25 private CurrencyDataEntry(String entity, String currency, String alphabeticCode, Integer numericCode, Integer minorUnit, String withdrawalDate, String remark, boolean historic) { 26 this.entity = entity; 27 this.currency = currency; 28 this.alphabeticCode = alphabeticCode; 29 this.numericCode = numericCode; 30 this.minorUnit = minorUnit; 31 this.withdrawalDate = withdrawalDate; 32 this.remark = remark; 33 this.historic = historic; 34 } 35 entity()36 public String entity() { 37 return entity; 38 } 39 currency()40 public String currency() { 41 return currency; 42 } 43 alphabeticCode()44 public String alphabeticCode() { 45 return alphabeticCode; 46 } 47 numericCode()48 public Integer numericCode() { 49 return numericCode; 50 } 51 minorUnit()52 public Integer minorUnit() { 53 return minorUnit; 54 } 55 withdrawalDate()56 public String withdrawalDate() { 57 return withdrawalDate; 58 } 59 remark()60 public String remark() { 61 return remark; 62 } 63 historic()64 public boolean historic() { 65 return historic; 66 } 67 68 public static class Builder { 69 private String entity_; 70 private String currency_; 71 private String alphabeticCode_; 72 private Integer numericCode_; 73 private Integer minorUnit_; 74 75 private String withdrawalDate_; 76 private String remark_; 77 private boolean historic_ = false; 78 setEntity(String entity)79 public Builder setEntity(String entity) { 80 entity_ = entity; 81 return this; 82 } 83 setCurrency(String currency)84 public Builder setCurrency(String currency) { 85 currency_ = currency; 86 return this; 87 } 88 setAlphabeticCode(String alphabeticCode)89 public Builder setAlphabeticCode(String alphabeticCode) { 90 alphabeticCode_ = alphabeticCode; 91 return this; 92 } 93 setNumericCode(String numericCode)94 public Builder setNumericCode(String numericCode) { 95 try { 96 numericCode_ = Integer.parseInt(numericCode); 97 } catch (NumberFormatException e) { 98 // ignore 99 } 100 return this; 101 } 102 setMinorUnit(String minorUnit)103 public Builder setMinorUnit(String minorUnit) { 104 try { 105 minorUnit_ = Integer.parseInt(minorUnit); 106 } catch (NumberFormatException e) { 107 // ignore 108 } 109 return this; 110 } 111 setWithdrawalDate(String withdrawalDate)112 public Builder setWithdrawalDate(String withdrawalDate) { 113 withdrawalDate_ = withdrawalDate; 114 return this; 115 } 116 setRemark(String remark)117 public Builder setRemark(String remark) { 118 remark_ = remark; 119 return this; 120 } 121 setHistoric()122 public Builder setHistoric() { 123 historic_ = true; 124 return this; 125 } 126 build()127 public CurrencyDataEntry build() { 128 return new CurrencyDataEntry(entity_, currency_, alphabeticCode_, numericCode_, minorUnit_, withdrawalDate_, remark_, historic_); 129 } 130 reset()131 public Builder reset() { 132 entity_ = null; 133 currency_ = null; 134 alphabeticCode_ = null; 135 numericCode_ = null; 136 minorUnit_ = null; 137 withdrawalDate_ = null; 138 remark_ = null; 139 historic_ = false; 140 return this; 141 } 142 } 143 } 144