2323/**
2424 * This class models an exchange rate, which defines the factor the numeric value of a base amount in some currency
2525 * 'A' must be multiplied
26- * to get the corresponding amount in the terminating currency 'B'. Hereby
26+ * to getTyped the corresponding amount in the terminating currency 'B'. Hereby
2727 * <ul>
2828 * <li>an exchange rate always models one rate from a base (source) to a term
2929 * (target) {@link javax.money.CurrencyUnit}.</li>
8181 * href="https://en.wikipedia.org/wiki/Exchange_rate#Quotations">Wikipedia:
8282 * Exchange Rate (Quotations)</a>
8383 */
84- public class TestExchangeRate implements ExchangeRate , Serializable , Comparable <ExchangeRate >{
84+ public class TestExchangeRate implements ExchangeRate , Serializable , Comparable <ExchangeRate > {
8585
8686 /**
8787 * serialVersionUID.
@@ -115,7 +115,7 @@ public class TestExchangeRate implements ExchangeRate, Serializable, Comparable<
115115 *
116116 * @param builder The Builder, never {@code null}.
117117 */
118- private TestExchangeRate (Builder builder ){
118+ private TestExchangeRate (Builder builder ) {
119119 Objects .requireNonNull (builder .base , "base may not be null." );
120120 Objects .requireNonNull (builder .term , "term may not be null." );
121121 Objects .requireNonNull (builder .factor , "factor may not be null." );
@@ -129,18 +129,18 @@ private TestExchangeRate(Builder builder){
129129 }
130130
131131 /**
132- * Internal method to set the rate chain, which also ensure that the chain
132+ * Internal method to setTyped the rate chain, which also ensure that the chain
133133 * passed, when not null, contains valid elements.
134134 *
135- * @param chain the chain to set .
135+ * @param chain the chain to setTyped .
136136 */
137- private void setExchangeRateChain (List <ExchangeRate > chain ){
137+ private void setExchangeRateChain (List <ExchangeRate > chain ) {
138138 this .chain .clear ();
139- if (chain == null || chain .isEmpty ()){
139+ if (chain == null || chain .isEmpty ()) {
140140 this .chain .add (this );
141- }else {
142- for (ExchangeRate aChain : chain ){
143- if (chain == null ){
141+ } else {
142+ for (ExchangeRate aChain : chain ) {
143+ if (chain == null ) {
144144 throw new IllegalArgumentException ("Chain element can not be null." );
145145 }
146146 }
@@ -153,7 +153,7 @@ private void setExchangeRateChain(List<ExchangeRate> chain){
153153 *
154154 * @return the conversion context, never null.
155155 */
156- public final ConversionContext getConversionContext (){
156+ public final ConversionContext getConversionContext () {
157157 return this .conversionContext ;
158158 }
159159
@@ -162,7 +162,7 @@ public final ConversionContext getConversionContext(){
162162 *
163163 * @return the base {@link javax.money.CurrencyUnit}.
164164 */
165- public final CurrencyUnit getBaseCurrency (){
165+ public final CurrencyUnit getBaseCurrency () {
166166 return this .base ;
167167 }
168168
@@ -171,7 +171,7 @@ public final CurrencyUnit getBaseCurrency(){
171171 *
172172 * @return the term {@link javax.money.CurrencyUnit}.
173173 */
174- public final CurrencyUnit getCurrency (){
174+ public final CurrencyUnit getCurrency () {
175175 return this .term ;
176176 }
177177
@@ -180,7 +180,7 @@ public final CurrencyUnit getCurrency(){
180180 *
181181 * @return the bid factor for this exchange rate, or {@code null}.
182182 */
183- public final NumberValue getFactor (){
183+ public final NumberValue getFactor () {
184184 return this .factor ;
185185 }
186186
@@ -191,7 +191,7 @@ public final NumberValue getFactor(){
191191 * several instances. For a direct exchange rate, this equals to
192192 * <code>new ExchangeRate[]{this}</code>.
193193 */
194- public final List <ExchangeRate > getExchangeRateChain (){
194+ public final List <ExchangeRate > getExchangeRateChain () {
195195 return this .chain ;
196196 }
197197
@@ -206,7 +206,7 @@ public final List<ExchangeRate> getExchangeRateChain(){
206206 *
207207 * @return true, if the exchange rate is derived.
208208 */
209- public final boolean isDerived (){
209+ public final boolean isDerived () {
210210 return this .chain .size () > 1 ;
211211 }
212212
@@ -216,15 +216,15 @@ public final boolean isDerived(){
216216 * @see java.lang.Comparable#compareTo(java.lang.Object)
217217 */
218218 @ Override
219- public int compareTo (ExchangeRate o ){
220- if (o == null ){
219+ public int compareTo (ExchangeRate o ) {
220+ if (o == null ) {
221221 return -1 ;
222222 }
223223 int compare = this .getBaseCurrency ().getCurrencyCode ().compareTo (o .getBaseCurrency ().getCurrencyCode ());
224- if (compare == 0 ){
224+ if (compare == 0 ) {
225225 compare = this .getCurrency ().getCurrencyCode ().compareTo (o .getCurrency ().getCurrencyCode ());
226226 }
227- if (compare == 0 ){
227+ if (compare == 0 ) {
228228 compare = this .getConversionContext ().getProvider ().compareTo (o .getConversionContext ().getProvider ());
229229 }
230230 return compare ;
@@ -236,7 +236,7 @@ public int compareTo(ExchangeRate o){
236236 * @see java.lang.Object#toString()
237237 */
238238 @ Override
239- public String toString (){
239+ public String toString () {
240240 return "ExchangeRate [base=" + base + ", factor=" + factor + ", conversionContext=" + conversionContext + "]" ;
241241 }
242242
@@ -246,7 +246,7 @@ public String toString(){
246246 * @see java.lang.Object#hashCode()
247247 */
248248 @ Override
249- public int hashCode (){
249+ public int hashCode () {
250250 final int prime = 31 ;
251251 int result = 1 ;
252252 result = prime * result + ((base == null ) ? 0 : base .hashCode ());
@@ -263,46 +263,46 @@ public int hashCode(){
263263 * @see java.lang.Object#equals(java.lang.Object)
264264 */
265265 @ Override
266- public boolean equals (Object obj ){
267- if (this == obj ){
266+ public boolean equals (Object obj ) {
267+ if (this == obj ) {
268268 return true ;
269269 }
270- if (obj == null ){
270+ if (obj == null ) {
271271 return false ;
272272 }
273- if (getClass () != obj .getClass ()){
273+ if (getClass () != obj .getClass ()) {
274274 return false ;
275275 }
276276 TestExchangeRate other = (TestExchangeRate ) obj ;
277- if (base == null ){
278- if (other .base != null ){
277+ if (base == null ) {
278+ if (other .base != null ) {
279279 return false ;
280280 }
281- }else if (!base .equals (other .base )){
281+ } else if (!base .equals (other .base )) {
282282 return false ;
283283 }
284- if (!chain .equals (other .getExchangeRateChain ())){
284+ if (!chain .equals (other .getExchangeRateChain ())) {
285285 return false ;
286286 }
287- if (conversionContext == null ){
288- if (other .conversionContext != null ){
287+ if (conversionContext == null ) {
288+ if (other .conversionContext != null ) {
289289 return false ;
290290 }
291- }else if (!conversionContext .equals (other .conversionContext )){
291+ } else if (!conversionContext .equals (other .conversionContext )) {
292292 return false ;
293293 }
294- if (factor == null ){
295- if (other .factor != null ){
294+ if (factor == null ) {
295+ if (other .factor != null ) {
296296 return false ;
297297 }
298- }else if (!factor .equals (other .factor )){
298+ } else if (!factor .equals (other .factor )) {
299299 return false ;
300300 }
301- if (term == null ){
302- if (other .term != null ){
301+ if (term == null ) {
302+ if (other .term != null ) {
303303 return false ;
304304 }
305- }else if (!term .equals (other .term )){
305+ } else if (!term .equals (other .term )) {
306306 return false ;
307307 }
308308 return true ;
@@ -315,7 +315,7 @@ public boolean equals(Object obj){
315315 * @author Anatole Tresch
316316 * @author Werner Keil
317317 */
318- public static class Builder {
318+ public static class Builder {
319319
320320 /**
321321 * The {@link javax.money.convert.ConversionContext}.
@@ -343,7 +343,7 @@ public static class Builder{
343343 *
344344 * @param rateType the {@link javax.money.convert.RateType} contained
345345 */
346- public Builder (String provider , RateType rateType ){
346+ public Builder (String provider , RateType rateType ) {
347347 this (ConversionContext .of (provider , rateType ));
348348 }
349349
@@ -352,7 +352,7 @@ public Builder(String provider, RateType rateType){
352352 *
353353 * @param context the {@link javax.money.convert.ConversionContext} to be applied
354354 */
355- public Builder (ConversionContext context ){
355+ public Builder (ConversionContext context ) {
356356 setContext (context );
357357 }
358358
@@ -361,7 +361,7 @@ public Builder(ConversionContext context){
361361 *
362362 * @param rate the {@link javax.money.convert.ExchangeRate} to be applied
363363 */
364- public Builder (ExchangeRate rate ){
364+ public Builder (ExchangeRate rate ) {
365365 setContext (rate .getConversionContext ());
366366 setFactor (rate .getFactor ());
367367 setTerm (rate .getCurrency ());
@@ -375,7 +375,7 @@ public Builder(ExchangeRate rate){
375375 * @param base to base (source) {@link javax.money.CurrencyUnit} to be applied
376376 * @return the builder instance
377377 */
378- public Builder setBase (CurrencyUnit base ){
378+ public Builder setBase (CurrencyUnit base ) {
379379 this .base = base ;
380380 return this ;
381381 }
@@ -386,7 +386,7 @@ public Builder setBase(CurrencyUnit base){
386386 * @param term to terminating {@link javax.money.CurrencyUnit} to be applied
387387 * @return the builder instance
388388 */
389- public Builder setTerm (CurrencyUnit term ){
389+ public Builder setTerm (CurrencyUnit term ) {
390390 this .term = term ;
391391 return this ;
392392 }
@@ -397,9 +397,9 @@ public Builder setTerm(CurrencyUnit term){
397397 * @param exchangeRates the {@link javax.money.convert.ExchangeRate} chain to be applied
398398 * @return the builder instance
399399 */
400- public Builder setRateChain (ExchangeRate ... exchangeRates ){
400+ public Builder setRateChain (ExchangeRate ... exchangeRates ) {
401401 this .rateChain .clear ();
402- if (exchangeRates != null ){
402+ if (exchangeRates != null ) {
403403 this .rateChain .addAll (Arrays .asList (exchangeRates .clone ()));
404404 }
405405 return this ;
@@ -411,9 +411,9 @@ public Builder setRateChain(ExchangeRate... exchangeRates){
411411 * @param exchangeRates the {@link javax.money.convert.ExchangeRate} chain to be applied
412412 * @return the builder instance
413413 */
414- public Builder setRateChain (List <ExchangeRate > exchangeRates ){
414+ public Builder setRateChain (List <ExchangeRate > exchangeRates ) {
415415 this .rateChain .clear ();
416- if (exchangeRates != null ){
416+ if (exchangeRates != null ) {
417417 this .rateChain .addAll (exchangeRates );
418418 }
419419 return this ;
@@ -427,7 +427,7 @@ public Builder setRateChain(List<ExchangeRate> exchangeRates){
427427 * @param factor the factor.
428428 * @return The builder instance.
429429 */
430- public Builder setFactor (NumberValue factor ){
430+ public Builder setFactor (NumberValue factor ) {
431431 this .factor = factor ;
432432 return this ;
433433 }
@@ -438,7 +438,7 @@ public Builder setFactor(NumberValue factor){
438438 * @param conversionContext the {@link javax.money.convert.ConversionContext}, not null.
439439 * @return The builder.
440440 */
441- public Builder setContext (ConversionContext conversionContext ){
441+ public Builder setContext (ConversionContext conversionContext ) {
442442 Objects .requireNonNull (conversionContext );
443443 this .conversionContext = conversionContext ;
444444 return this ;
@@ -450,7 +450,7 @@ public Builder setContext(ConversionContext conversionContext){
450450 * @return a new instance of {@link javax.money.convert.ExchangeRate}.
451451 * @throws IllegalArgumentException if the rate could not be built.
452452 */
453- public TestExchangeRate build (){
453+ public TestExchangeRate build () {
454454 return new TestExchangeRate (this );
455455 }
456456
@@ -462,7 +462,7 @@ public TestExchangeRate build(){
462462 * @param rate the base rate
463463 * @return the Builder, for chaining.
464464 */
465- public Builder setRate (ExchangeRate rate ){
465+ public Builder setRate (ExchangeRate rate ) {
466466 this .base = rate .getBaseCurrency ();
467467 this .term = rate .getCurrency ();
468468 this .conversionContext = rate .getConversionContext ();
@@ -478,7 +478,7 @@ public Builder setRate(ExchangeRate rate){
478478 *
479479 * @return a new {@link Builder}, never {@code null}.
480480 */
481- public Builder toBuilder (){
481+ public Builder toBuilder () {
482482 return new Builder (getConversionContext ()).setBase (getBaseCurrency ()).setTerm (getCurrency ())
483483 .setFactor (getFactor ()).setRateChain (getExchangeRateChain ());
484484 }
0 commit comments