Skip to content

Commit

Permalink
Fixed compatibility issues between bp and Java 8 API.
Browse files Browse the repository at this point in the history
  • Loading branch information
atsticks committed May 6, 2016
1 parent 7ffa99e commit e2e7df9
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/javamoney/moneta/ExchangeRateType.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public enum ExchangeRateType implements ExchangeRateProviderSupplier {
"IDENT",
"Exchange rate rate with factor one for identical base/term currencies");

private static final long serialVersionUID = 7769702054407198263L;

private final String type;

private final String description;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/javamoney/moneta/FastMoney.java
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ public String toString() {
* @throws NullPointerException If the number is null
* @throws java.lang.ArithmeticException If the number exceeds the capabilities of this class.
*/
private void checkNumber(Number number) {
protected void checkNumber(Number number) {
Objects.requireNonNull(number, "Number is required.");
// numeric check for overflow...
if (number.longValue() > MAX_BD.longValue()) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/javamoney/moneta/RoundedMoney.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public final class RoundedMoney implements MonetaryAmount, Comparable<MonetaryAm
/**
* serialVersionUID.
*/
private static final long serialVersionUID = 366517590511294389L;
private static final long serialVersionUID = -6716367273185192901L;
/**
* The default {@link MonetaryContext} applied.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ MonetaryAmount to(ParserMonetaryAmount amount) {
}
};

private static final long serialVersionUID = 6606016328162974467L;
abstract MonetaryAmount to(ParserMonetaryAmount amount);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @see {@link MonetaryRoundedFactoryBuilder#withPrecision(int)}
* @since 1.0.1
*/
final class MonetaryRoundedFactoryBuilder {
public final class MonetaryRoundedFactoryBuilder {

private final RoundingMode roundingMode;

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/javamoney/moneta/spi/AbstractAmountBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,18 @@ public MonetaryAmountFactory<T> setAmount(MonetaryAmount smount) {
return this;
}

/**
* Creates a {@link BigDecimal} from the given {@link Number} doing the valid conversion
* depending the type given.
*
* @param num the number type
* @return the corresponding {@link BigDecimal}
* @Deprecated will be removed in next release
*/
@Deprecated
protected static BigDecimal getBigDecimal(Number num) {
return ConvertBigDecimal.of(num);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ public class CompoundRateProvider extends AbstractRateProvider {
/**
* Key used to store a list of child {@link javax.money.convert.ProviderContext} instances of the providers
* contained within this instance.
* @deprecated Will be private in next major release.
*/
private static final String CHILD_PROVIDER_CONTEXTS_KEY = "childProviderContexts";
@Deprecated
public static final String CHILD_PROVIDER_CONTEXTS_KEY = "childProviderContexts";
/**
* The {@link ExchangeRateProvider} instances.
*/
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/org/javamoney/moneta/spi/DefaultNumberValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,21 @@ public <T extends Number> T numberValueExact(Class<T> numberType) {
return ConvertNumberValue.ofExact(numberType, number);
}

/**
* Creates a {@link BigDecimal} from the given {@link Number} doing the valid conversion
* depending the type given.
*
* @param num
* the number type
* @return the corresponding {@link BigDecimal}
* @deprecated will be removed.
*/
@Deprecated
protected static BigDecimal getBigDecimal(Number num) {
return ConvertBigDecimal.of(num);
}


/*
* (non-Javadoc)
* @see java.lang.Object#toString()
Expand Down

0 comments on commit e2e7df9

Please sign in to comment.