Skip to content

Commit 04945be

Browse files
committed
Unified getCurrency/setCurrency method names. Adapted to this change.
2 parents 81163a6 + 966760b commit 04945be

File tree

4 files changed

+16
-39
lines changed

4 files changed

+16
-39
lines changed

src/main/java/javax/money/MonetaryAmount.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,11 @@
8888
*
8989
* @author Anatole Tresch
9090
* @author Werner Keil
91-
* @version 0.8.1
91+
* @version 0.8.2
9292
* @see #with(MonetaryOperator)
9393
*/
9494
public interface MonetaryAmount extends CurrencySupplier, NumberSupplier, Comparable<MonetaryAmount> {
9595

96-
/**
97-
* Returns the amount’s currency, modeled as {@link CurrencyUnit}. Implementations may
98-
* co-variantly change the return type to a more specific implementation of {@link CurrencyUnit}
99-
* if desired.
100-
*
101-
* @return the currency, never {@code null}
102-
*/
103-
CurrencyUnit getCurrency();
104-
10596
/**
10697
* Returns the {@link MonetaryContext} of this {@code MonetaryAmount}. The
10798
* {@link MonetaryContext} provides additional information about the numeric representation and
@@ -113,16 +104,6 @@ public interface MonetaryAmount extends CurrencySupplier, NumberSupplier, Compar
113104
*/
114105
MonetaryContext getMonetaryContext();
115106

116-
/**
117-
* Simple accessor for the numeric part of a {@link MonetaryAmount}. The representation type
118-
* returned should be the best matching according to the internal representation. In all cases
119-
* never any truncation should occur, so this method must be exact regarding the numeric value
120-
* externalized.
121-
*
122-
* @return the numeric value of this {@link MonetaryAmount}, never {@code null}.
123-
*/
124-
NumberValue getNumber();
125-
126107
/**
127108
* Queries this monetary amount for a value.
128109
* <p>

src/main/java/javax/money/NumberSupplier.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* <p>
2323
* This is a <b>functional interface</b> whose
2424
* functional method is {@link #getNumber()}.
25-
* This class does not extends {@link java.util.function.Supplier} since {@link javax.money.MonetaryAmount} implements
25+
* This class does not extend {@link java.util.function.Supplier} since {@link javax.money.MonetaryAmount} implements
2626
* both supplier interfaces, {@link javax.money.NumberSupplier} and {@link javax.money.CurrencySupplier},
2727
* which will lead
2828
* to method name conflicts.
@@ -43,4 +43,4 @@ public interface NumberSupplier {
4343
* @return the corresponding {@link javax.money.NumberValue}, not null.
4444
*/
4545
NumberValue getNumber();
46-
}
46+
}

src/main/java/javax/money/RoundingContext.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import java.io.Serializable;
1212

1313
/**
14-
* This class models the spec/configuration for a rounding, modelled as {@link javax.money.MonetaryRounding} in a
14+
* This class models the spec/configuration for a rounding, modeled as {@link javax.money.MonetaryRounding} in a
1515
* platform independent way. Each RoundingContext instance hereby has a <code>roundingId</code>, which links
1616
* to the {@link javax.money.spi.RoundingProviderSpi} that must create the according rounding instance. The
1717
* <i>default</i> </i><code>roundingId</code> is <code>default</code>.<br/>
@@ -26,10 +26,11 @@
2626
*
2727
* @author Anatole Tresch
2828
*/
29-
public final class RoundingContext extends AbstractContext implements Serializable, CurrencySupplier{
30-
/**
31-
* Attribute key used for the rounding name.
32-
*/
29+
public final class RoundingContext extends AbstractContext implements Serializable{
30+
31+
private static final long serialVersionUID = -1879443887564347935L;
32+
33+
/** Attribute key used for the rounding name. */
3334
static final String KEY_ROUNDING_NAME = "roundingName";
3435

3536
/**
@@ -55,7 +56,7 @@ public String getRoundingName(){
5556
*
5657
* @return the target CurrencyUnit, or null.
5758
*/
58-
public CurrencyUnit getCurrency(){
59+
public CurrencyUnit getCurrencyUnit(){
5960
return get(CurrencyUnit.class, (CurrencyUnit) null);
6061
}
6162

src/main/java/javax/money/RoundingQuery.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,12 @@
2424
* <p>
2525
* This class is immutable, thread-safe and serializable.
2626
*/
27-
public final class RoundingQuery extends AbstractQuery implements CurrencySupplier{
27+
public final class RoundingQuery extends AbstractQuery{
2828

29-
/**
30-
* Attribute key used for the rounding name attribute.
31-
*/
29+
/** Attribute key used for the rounding name attribute. */
3230
static final String KEY_QUERY_ROUNDING_NAME = "Query.roundingName";
3331

34-
/**
35-
* Attribute key used for the scale attribute.
36-
*/
32+
/** Attribute key used for the scale attribute. */
3733
static final String KEY_QUERY_SCALE = "Query.scale";
3834

3935
/**
@@ -68,16 +64,15 @@ public Integer getScale(){
6864
return getInt(KEY_QUERY_SCALE, null);
6965
}
7066

71-
7267
/**
73-
* Returns the target CurrencyUnit, or null.
74-
* Typically this determines all other properties, such as scale and the concrete rounding algorithm. With
68+
* Sets the target CurrencyUnit. Typically this determines all other properties,
69+
* such as scale and the concrete rounding algorithm. With
7570
* rounding names, depending on the implementation, additional sub-selections are possible. Similarly
7671
* additional attributes can be used to select special rounding instances, e.g. for cash rounding.
7772
*
7873
* @return the CurrencyUnit, or null.
7974
*/
80-
public CurrencyUnit getCurrency(){
75+
public CurrencyUnit getCurrencyUnit(){
8176
return get(CurrencyUnit.class, (CurrencyUnit) null);
8277
}
8378

0 commit comments

Comments
 (0)