Skip to content

Commit 061779a

Browse files
committed
Updated some aspects, merged changes from Ottavio.
1 parent b4fbc80 commit 061779a

File tree

11 files changed

+583
-583
lines changed

11 files changed

+583
-583
lines changed

src/main/java/org/javamoney/moneta/ExchangeRateBuilder.java

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* @author Anatole Tresch
1919
* @author Werner Keil
2020
*/
21-
public class ExchangeRateBuilder{
21+
public class ExchangeRateBuilder {
2222

2323
/**
2424
* The {@link javax.money.convert.ConversionContext}.
@@ -46,7 +46,7 @@ public class ExchangeRateBuilder{
4646
*
4747
* @param rateType the {@link javax.money.convert.RateType} contained
4848
*/
49-
public ExchangeRateBuilder(String provider, RateType rateType){
49+
public ExchangeRateBuilder(String provider, RateType rateType) {
5050
this(ConversionContext.of(provider, rateType));
5151
}
5252

@@ -55,7 +55,7 @@ public ExchangeRateBuilder(String provider, RateType rateType){
5555
*
5656
* @param context the {@link javax.money.convert.ConversionContext} to be applied
5757
*/
58-
public ExchangeRateBuilder(ConversionContext context){
58+
public ExchangeRateBuilder(ConversionContext context) {
5959
setContext(context);
6060
}
6161

@@ -64,7 +64,7 @@ public ExchangeRateBuilder(ConversionContext context){
6464
*
6565
* @param rate the {@link javax.money.convert.ExchangeRate} to be applied
6666
*/
67-
public ExchangeRateBuilder(ExchangeRate rate){
67+
public ExchangeRateBuilder(ExchangeRate rate) {
6868
setContext(rate.getConversionContext());
6969
setFactor(rate.getFactor());
7070
setTerm(rate.getCurrency());
@@ -78,7 +78,7 @@ public ExchangeRateBuilder(ExchangeRate rate){
7878
* @param base to base (source) {@link javax.money.CurrencyUnit} to be applied
7979
* @return the builder instance
8080
*/
81-
public ExchangeRateBuilder setBase(CurrencyUnit base){
81+
public ExchangeRateBuilder setBase(CurrencyUnit base) {
8282
this.base = base;
8383
return this;
8484
}
@@ -89,7 +89,7 @@ public ExchangeRateBuilder setBase(CurrencyUnit base){
8989
* @param term to terminating {@link javax.money.CurrencyUnit} to be applied
9090
* @return the builder instance
9191
*/
92-
public ExchangeRateBuilder setTerm(CurrencyUnit term){
92+
public ExchangeRateBuilder setTerm(CurrencyUnit term) {
9393
this.term = term;
9494
return this;
9595
}
@@ -100,9 +100,9 @@ public ExchangeRateBuilder setTerm(CurrencyUnit term){
100100
* @param exchangeRates the {@link javax.money.convert.ExchangeRate} chain to be applied
101101
* @return the builder instance
102102
*/
103-
public ExchangeRateBuilder setRateChain(ExchangeRate... exchangeRates){
103+
public ExchangeRateBuilder setRateChain(ExchangeRate... exchangeRates) {
104104
this.rateChain.clear();
105-
if(Objects.nonNull(exchangeRates)){
105+
if (Objects.nonNull(exchangeRates)) {
106106
this.rateChain.addAll(Arrays.asList(exchangeRates.clone()));
107107
}
108108
return this;
@@ -114,9 +114,9 @@ public ExchangeRateBuilder setRateChain(ExchangeRate... exchangeRates){
114114
* @param exchangeRates the {@link javax.money.convert.ExchangeRate} chain to be applied
115115
* @return the builder instance
116116
*/
117-
public ExchangeRateBuilder setRateChain(List<ExchangeRate> exchangeRates){
117+
public ExchangeRateBuilder setRateChain(List<ExchangeRate> exchangeRates) {
118118
this.rateChain.clear();
119-
if(Objects.nonNull(exchangeRates)){
119+
if (Objects.nonNull(exchangeRates)) {
120120
this.rateChain.addAll(exchangeRates);
121121
}
122122
return this;
@@ -130,7 +130,7 @@ public ExchangeRateBuilder setRateChain(List<ExchangeRate> exchangeRates){
130130
* @param factor the factor.
131131
* @return The builder instance.
132132
*/
133-
public ExchangeRateBuilder setFactor(NumberValue factor){
133+
public ExchangeRateBuilder setFactor(NumberValue factor) {
134134
this.factor = factor;
135135
return this;
136136
}
@@ -141,7 +141,7 @@ public ExchangeRateBuilder setFactor(NumberValue factor){
141141
* @param conversionContext the {@link javax.money.convert.ConversionContext}, not null.
142142
* @return The builder.
143143
*/
144-
public ExchangeRateBuilder setContext(ConversionContext conversionContext){
144+
public ExchangeRateBuilder setContext(ConversionContext conversionContext) {
145145
Objects.requireNonNull(conversionContext);
146146
this.conversionContext = conversionContext;
147147
return this;
@@ -153,7 +153,7 @@ public ExchangeRateBuilder setContext(ConversionContext conversionContext){
153153
* @return a new instance of {@link javax.money.convert.ExchangeRate}.
154154
* @throws IllegalArgumentException if the rate could not be built.
155155
*/
156-
public ExchangeRate build(){
156+
public ExchangeRate build() {
157157
return new DefaultExchangeRate(this);
158158
}
159159

@@ -165,7 +165,7 @@ public ExchangeRate build(){
165165
* @param rate the base rate
166166
* @return the Builder, for chaining.
167167
*/
168-
public ExchangeRateBuilder setRate(ExchangeRate rate){
168+
public ExchangeRateBuilder setRate(ExchangeRate rate) {
169169
this.base = rate.getBaseCurrency();
170170
this.term = rate.getCurrency();
171171
this.conversionContext = rate.getConversionContext();
@@ -175,15 +175,15 @@ public ExchangeRateBuilder setRate(ExchangeRate rate){
175175
return this;
176176
}
177177

178-
@Override
179-
public String toString() {
180-
StringBuilder sb = new StringBuilder();
181-
sb.append("org.javamoney.moneta.ExchangeRateBuilder: ");
182-
sb.append("[conversionContext").append(conversionContext).append(',');
183-
sb.append("base").append(base).append(',');
184-
sb.append("term").append(term).append(',');
185-
sb.append("factor").append(factor).append(',');
186-
sb.append("rateChain").append(rateChain).append(']');
187-
return sb.toString();
188-
}
178+
@Override
179+
public String toString() {
180+
StringBuilder sb = new StringBuilder();
181+
sb.append("org.javamoney.moneta.ExchangeRateBuilder: ");
182+
sb.append("[conversionContext").append(conversionContext).append(',');
183+
sb.append("base").append(base).append(',');
184+
sb.append("term").append(term).append(',');
185+
sb.append("factor").append(factor).append(',');
186+
sb.append("rateChain").append(rateChain).append(']');
187+
return sb.toString();
188+
}
189189
}

src/main/java/org/javamoney/moneta/ExchangeRateType.java

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,56 +14,56 @@
1414
* to choose an available implementation.
1515
* </p>
1616
* <code>ExchangeRateProvider provider = MonetaryConversions.getExchangeRateProvider(ExchangeRateType.ECB);<code>
17-
*
17+
*
1818
* @author otaviojava
1919
*/
2020
public enum ExchangeRateType implements ExchangeRateProviderSupplier {
21-
/**
22-
* Exchange rate to the European Central Bank. Uses the
23-
* {@link ECBCurrentRateProvider} implementation.
24-
*/
25-
ECB("ECB", "Exchange rate to the European Central Bank."),
26-
/**
27-
* Exchange rate to the International Monetary Fond. Uses the
28-
* {@link IMFRateProvider} implementation.
29-
*/
30-
IMF("IMF", "Exchange rate to the International Monetary Fond."),
31-
/**
32-
* Exchange rate to European Central Bank (last 90 days). Uses the
33-
* {@link ECBHistoric90RateProvider} implementation.
34-
*/
35-
ECB_HIST90("ECB-HIST90",
36-
"Exchange rate to European Central Bank (last 90 days)."),
37-
/**
38-
* Uses the {@link ECBHistoricRateProvider} implementation.
39-
*/
40-
ECB_HIST(
41-
"ECB-HIST",
42-
"Exchange rate to the European Central Bank that loads all data up to 1999 into its historic data cache."),
43-
/**
44-
* Uses the {@link IdentityRateProvider} implementation.
45-
*/
46-
IDENTITY(
47-
"IDENT",
48-
"Exchange rate rate with factor one for identical base/term currencies");
21+
/**
22+
* Exchange rate to the European Central Bank. Uses the
23+
* {@link ECBCurrentRateProvider} implementation.
24+
*/
25+
ECB("ECB", "Exchange rate to the European Central Bank."),
26+
/**
27+
* Exchange rate to the International Monetary Fond. Uses the
28+
* {@link IMFRateProvider} implementation.
29+
*/
30+
IMF("IMF", "Exchange rate to the International Monetary Fond."),
31+
/**
32+
* Exchange rate to European Central Bank (last 90 days). Uses the
33+
* {@link ECBHistoric90RateProvider} implementation.
34+
*/
35+
ECB_HIST90("ECB-HIST90",
36+
"Exchange rate to European Central Bank (last 90 days)."),
37+
/**
38+
* Uses the {@link ECBHistoricRateProvider} implementation.
39+
*/
40+
ECB_HIST(
41+
"ECB-HIST",
42+
"Exchange rate to the European Central Bank that loads all data up to 1999 into its historic data cache."),
43+
/**
44+
* Uses the {@link IdentityRateProvider} implementation.
45+
*/
46+
IDENTITY(
47+
"IDENT",
48+
"Exchange rate rate with factor one for identical base/term currencies");
4949

50-
private String type;
50+
private String type;
5151

52-
private String description;
52+
private String description;
5353

54-
ExchangeRateType(String type, String description) {
55-
this.type = type;
56-
this.description = description;
57-
}
54+
ExchangeRateType(String type, String description) {
55+
this.type = type;
56+
this.description = description;
57+
}
5858

59-
@Override
60-
public String get() {
61-
return type;
62-
}
59+
@Override
60+
public String get() {
61+
return type;
62+
}
6363

64-
@Override
65-
public String getDescription() {
66-
return description;
67-
}
64+
@Override
65+
public String getDescription() {
66+
return description;
67+
}
6868

6969
}

0 commit comments

Comments
 (0)