Skip to content

Commit f2c78c8

Browse files
committed
Merge pull request #50 from JavaMoney/remove_method_monetary_operator
Removes identity on MonetaryOperator
2 parents f459208 + 7fcfcbe commit f2c78c8

27 files changed

+96
-99
lines changed

src/main/java/javax/money/AbstractContext.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public abstract class AbstractContext implements Serializable {
4444
*
4545
* @param builder the Builder.
4646
*/
47-
@SuppressWarnings("rawtypes")
4847
protected AbstractContext(AbstractContextBuilder<?, ?> builder) {
4948
data.putAll(builder.data);
5049
}
@@ -135,7 +134,6 @@ public Integer getInt(String key) {
135134
* @param key the attribute's key, not null.
136135
* @return the value, or null.
137136
*/
138-
@SuppressWarnings("BooleanMethodNameMustStartWithQuestion")
139137
public Boolean getBoolean(String key) {
140138
return get(key, Boolean.class);
141139
}

src/main/java/javax/money/AbstractContextBuilder.java

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* <p>
2323
* Instances of this class are not thread-safe and not serializable.
2424
*/
25-
@SuppressWarnings("unchecked")
25+
@SuppressWarnings({ "unchecked", "rawtypes" })
2626
public abstract class AbstractContextBuilder<B extends AbstractContextBuilder, C extends AbstractContext>{
2727

2828
/**
@@ -190,35 +190,6 @@ public B setProviderName(String provider) {
190190
set(AbstractContext.KEY_PROVIDER, provider);
191191
return (B) this;
192192
}
193-
//
194-
// /**
195-
// * Set the target timestamp in UTC millis. This allows to select historical roundings that were valid in the
196-
// * past. Its implementation specific, to what extend historical roundings are available. By default if this
197-
// * property is not set always current {@link javax.money.MonetaryRounding} instances are provided.
198-
// *
199-
// * @param timestamp the target timestamp
200-
// * @return this instance for chaining
201-
// * @see #setTimestamp(java.time.temporal.TemporalAccessor)
202-
// */
203-
// public B setTimestampMillis(long timestamp){
204-
// set(AbstractContext.KEY_TIMESTAMP, timestamp);
205-
// return (B) this;
206-
// }
207-
//
208-
// /**
209-
// * Set the target timestamp as {@link java.time.temporal.TemporalAccessor}. This allows to select historical
210-
// * roundings that were valid in the past. Its implementation specific, to what extend historical roundings
211-
// * are available. By default if this property is not set always current {@link javax.money.MonetaryRounding}
212-
// * instances are provided.
213-
// *
214-
// * @param timestamp the target timestamp
215-
// * @return this instance for chaining
216-
// * @see #setTimestampMillis(long)
217-
// */
218-
// public B setTimestamp(LocalDateTime timestamp) {
219-
// set(AbstractContext.KEY_TIMESTAMP, Objects.requireNonNull(timestamp));
220-
// return (B) this;
221-
// }
222193

223194
/**
224195
* Removes an entry of a certain keys. This can be useful, when a context is initialized with another
@@ -243,12 +214,6 @@ public B removeAttributes(String... keys) {
243214
*/
244215
public abstract C build();
245216

246-
/*
247-
* (non-Javadoc)
248-
*
249-
* @see Object#toString()
250-
*/
251-
252217
@Override
253218
public String toString(){
254219
return getClass().getSimpleName() + " [attributes:\n" + new TreeMap<>(data).toString() + ']';

src/main/java/javax/money/AbstractQuery.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
*/
2222
public abstract class AbstractQuery extends AbstractContext {
2323

24-
/**
24+
private static final long serialVersionUID = 5309190820845869327L;
25+
26+
/**
2527
* Key for storing the target providers to be queried
2628
*/
2729
protected static final String KEY_QUERY_PROVIDERS = "Query.providers";
@@ -42,7 +44,7 @@ public abstract class AbstractQuery extends AbstractContext {
4244
*
4345
* @param builder the builder, not null.
4446
*/
45-
protected AbstractQuery(AbstractQueryBuilder builder) {
47+
protected AbstractQuery(@SuppressWarnings("rawtypes") AbstractQueryBuilder builder) {
4648
super(builder);
4749
}
4850

src/main/java/javax/money/AbstractQueryBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* <p>
2222
* Instances of this class are not thread-safe and not serializable.
2323
*/
24+
@SuppressWarnings("rawtypes")
2425
public abstract class AbstractQueryBuilder<B extends javax.money.AbstractQueryBuilder, C extends AbstractQuery>
2526
extends AbstractContextBuilder<B, C> {
2627

src/main/java/javax/money/CurrencyContext.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
*/
2929
public final class CurrencyContext extends AbstractContext implements Serializable{
3030

31-
/**
31+
private static final long serialVersionUID = 8450310852172607016L;
32+
33+
34+
/**
3235
* Constructor, used from the {@link javax.money.CurrencyContextBuilder}.
3336
*
3437
* @param builder the corresponding builder, not null.

src/main/java/javax/money/CurrencyQuery.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
@SuppressWarnings("unchecked")
3232
public final class CurrencyQuery extends AbstractQuery implements Serializable {
3333

34-
/**
34+
private static final long serialVersionUID = -5117949582074719190L;
35+
36+
/**
3537
* Key for storing a countries to be queried.
3638
*/
3739
static final String KEY_QUERY_COUNTRIES = "Query.countries";

src/main/java/javax/money/Monetary.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF THE
66
* AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE"
77
* BUTTON AT THE BOTTOM OF THIS PAGE.
8-
*
8+
*
99
* Specification: JSR-354 Money and Currency API ("Specification")
10-
*
10+
*
1111
* Copyright (c) 2012-2015, Credit Suisse All rights reserved.
1212
*/
1313
package javax.money;
@@ -18,6 +18,7 @@
1818
import javax.money.spi.MonetaryAmountsSingletonSpi;
1919
import javax.money.spi.MonetaryCurrenciesSingletonSpi;
2020
import javax.money.spi.MonetaryRoundingsSingletonSpi;
21+
2122
import java.util.Collection;
2223
import java.util.List;
2324
import java.util.Locale;
@@ -373,7 +374,8 @@ public static Class<? extends MonetaryAmount> getDefaultAmountType() {
373374
* @param query the factory query, not null.
374375
* @return the factory found, or null.
375376
*/
376-
public static MonetaryAmountFactory getAmountFactory(MonetaryAmountFactoryQuery query) {
377+
@SuppressWarnings("rawtypes")
378+
public static MonetaryAmountFactory getAmountFactory(MonetaryAmountFactoryQuery query) {
377379
return Optional.ofNullable(MONETARY_AMOUNTS_SINGLETON_QUERY_SPI).orElseThrow(() -> new MonetaryException(
378380
"No MonetaryAmountsSingletonQuerySpi loaded, query functionality is not available."))
379381
.getAmountFactory(query);

src/main/java/javax/money/MonetaryAmountFactoryQuery.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
*/
2828
public final class MonetaryAmountFactoryQuery extends AbstractQuery implements Serializable {
2929

30-
/**
30+
private static final long serialVersionUID = -6961037049540444782L;
31+
32+
/**
3133
* Key name for the context.
3234
*/
3335
private static final String KEY_PRECISION = "precision";

src/main/java/javax/money/MonetaryContext.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
*/
2929
public final class MonetaryContext extends AbstractContext implements Serializable {
3030

31-
/**
31+
private static final long serialVersionUID = 500722564420978659L;
32+
33+
/**
3234
* Constant that defines under which key the amount type is stored in the context map.
3335
*/
3436
static final String AMOUNT_TYPE = "amountType";

src/main/java/javax/money/MonetaryOperator.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,4 @@ public interface MonetaryOperator{
6565
*/
6666
MonetaryAmount apply(MonetaryAmount amount);
6767

68-
/**
69-
* Returns a function that always returns its input argument.
70-
* @return an operator that always returns its input argument
71-
*/
72-
static MonetaryOperator identity() {
73-
return m -> m;
74-
}
7568
}

0 commit comments

Comments
 (0)