diff --git a/src/test/java/com/avaje/tests/model/ivo/CMoney.java b/src/test/java/com/avaje/tests/model/ivo/CMoney.java
index 011107317..a764d8696 100644
--- a/src/test/java/com/avaje/tests/model/ivo/CMoney.java
+++ b/src/test/java/com/avaje/tests/model/ivo/CMoney.java
@@ -4,25 +4,24 @@ import java.util.Currency;
/**
* Currency and Money.
- *
- * @author rbygrave
*
+ * @author rbygrave
*/
public class CMoney {
- private final Money amount;
- private final Currency currency;
-
- public CMoney(Money amount, Currency currency) {
- this.amount = amount;
- this.currency = currency;
- }
+ private final Money amount;
+ private final Currency currency;
- public Money getAmount() {
- return amount;
- }
+ public CMoney(Money amount, Currency currency) {
+ this.amount = amount;
+ this.currency = currency;
+ }
- public Currency getCurrency() {
- return currency;
- }
+ public Money getAmount() {
+ return amount;
+ }
+
+ public Currency getCurrency() {
+ return currency;
+ }
}
diff --git a/src/test/java/com/avaje/tests/model/ivo/ExhangeCMoneyRate.java b/src/test/java/com/avaje/tests/model/ivo/ExhangeCMoneyRate.java
index 00634d1de..c267e43f3 100644
--- a/src/test/java/com/avaje/tests/model/ivo/ExhangeCMoneyRate.java
+++ b/src/test/java/com/avaje/tests/model/ivo/ExhangeCMoneyRate.java
@@ -1,4 +1,3 @@
-
package com.avaje.tests.model.ivo;
/**
@@ -6,42 +5,42 @@ package com.avaje.tests.model.ivo;
*/
public class ExhangeCMoneyRate {
- private final Rate rate;
- private final CMoney cmoney;
-
- public ExhangeCMoneyRate(Rate rate, CMoney cmoney) {
- this.rate = rate;
- this.cmoney = cmoney;
- }
+ private final Rate rate;
+ private final CMoney cmoney;
- public Rate getRate() {
- return rate;
- }
+ public ExhangeCMoneyRate(Rate rate, CMoney cmoney) {
+ this.rate = rate;
+ this.cmoney = cmoney;
+ }
- public CMoney getCmoney() {
- return cmoney;
- }
+ public Rate getRate() {
+ return rate;
+ }
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof ExhangeCMoneyRate){
- ExhangeCMoneyRate e = (ExhangeCMoneyRate)obj;
- return e.rate.equals(rate) && e.cmoney.equals(cmoney);
- }
- return false;
- }
+ public CMoney getCmoney() {
+ return cmoney;
+ }
- @Override
- public int hashCode() {
- int hc = rate.hashCode();
- hc = hc * 31 + cmoney.hashCode();
- return hc;
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof ExhangeCMoneyRate) {
+ ExhangeCMoneyRate e = (ExhangeCMoneyRate) obj;
+ return e.rate.equals(rate) && e.cmoney.equals(cmoney);
}
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ int hc = rate.hashCode();
+ hc = hc * 31 + cmoney.hashCode();
+ return hc;
+ }
+
+ @Override
+ public String toString() {
+ return "rate=" + rate + " cmoney=" + cmoney;
+ }
+
- @Override
- public String toString() {
- return "rate="+rate+" cmoney="+cmoney;
- }
-
-
}
diff --git a/src/test/java/com/avaje/tests/model/ivo/Money.java b/src/test/java/com/avaje/tests/model/ivo/Money.java
index cabb85a94..0bcf3f002 100644
--- a/src/test/java/com/avaje/tests/model/ivo/Money.java
+++ b/src/test/java/com/avaje/tests/model/ivo/Money.java
@@ -9,134 +9,133 @@ import java.util.Iterator;
/**
* A representation of Money effectively wrapping BigDecimal.
*
- *
+ *
*
- * @author rbygrave
*
+ * @author rbygrave
*/
public final class Money implements Comparable, Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public static final Money ZERO = new Money(BigDecimal.ZERO);
-
- private final BigDecimal amount;
-
- public Money(BigDecimal amount) {
- if (amount == null){
- throw new NullPointerException("amount can not be null");
- }
- this.amount = amount;
- }
+ public static final Money ZERO = new Money(BigDecimal.ZERO);
- public Money(double val) {
- this(BigDecimal.valueOf(val));
- }
+ private final BigDecimal amount;
- public Money(String val) {
- this(new BigDecimal(val));
+ public Money(BigDecimal amount) {
+ if (amount == null) {
+ throw new NullPointerException("amount can not be null");
}
+ this.amount = amount;
+ }
- public String toString() {
- return amount.toString();
- }
-
-
-
- @Override
- public int hashCode() {
- return amount.hashCode();
- }
+ public Money(double val) {
+ this(BigDecimal.valueOf(val));
+ }
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof Money){
- // use BigDecimal.compareTo to handle scale differences
- return amount.compareTo(((Money)obj).getAmount()) == 0;
- }
- return false;
- }
+ public Money(String val) {
+ this(new BigDecimal(val));
+ }
- public int compareTo(Money o) {
- return amount.compareTo(o.amount);
- }
+ public String toString() {
+ return amount.toString();
+ }
- public BigDecimal getAmount() {
- return amount;
- }
-
- public Money subtract(Money amt){
- BigDecimal b = amount.subtract(amt.amount);
- return new Money(b);
- }
-
- public Money subtract(Money amt, MathContext ctx){
- BigDecimal b = amount.subtract(amt.amount, ctx);
- return new Money(b);
- }
-
- public Money add(Money amt){
- BigDecimal b = amount.add(amt.amount);
- return new Money(b);
- }
- public Money add(Money amt, MathContext ctx){
- BigDecimal b = amount.add(amt.amount, ctx);
- return new Money(b);
- }
+ @Override
+ public int hashCode() {
+ return amount.hashCode();
+ }
- public Money multiply(Money m){
- return multiply(m.amount);
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Money) {
+ // use BigDecimal.compareTo to handle scale differences
+ return amount.compareTo(((Money) obj).getAmount()) == 0;
}
+ return false;
+ }
- public Money multiply(int val){
- return multiply(BigDecimal.valueOf(val));
- }
+ public int compareTo(Money o) {
+ return amount.compareTo(o.amount);
+ }
- public Money multiply(float val){
- return multiply(BigDecimal.valueOf(val));
- }
+ public BigDecimal getAmount() {
+ return amount;
+ }
- public Money multiply(double val){
- return multiply(BigDecimal.valueOf(val));
- }
-
- public Money multiply(BigDecimal m){
- BigDecimal b = amount.multiply(m);
- return new Money(b);
- }
+ public Money subtract(Money amt) {
+ BigDecimal b = amount.subtract(amt.amount);
+ return new Money(b);
+ }
- public Money divide(BigDecimal divisor){
- BigDecimal b = amount.divide(divisor);
- return new Money(b);
- }
-
- public Money divide(BigDecimal divisor, MathContext ctx){
- BigDecimal b = amount.divide(divisor, ctx);
- return new Money(b);
- }
+ public Money subtract(Money amt, MathContext ctx) {
+ BigDecimal b = amount.subtract(amt.amount, ctx);
+ return new Money(b);
+ }
- public static Money sum(Money... m){
- BigDecimal t = BigDecimal.ZERO;
- for (Money money : m) {
- t = t.add(money.amount);
- }
- return new Money(t);
+ public Money add(Money amt) {
+ BigDecimal b = amount.add(amt.amount);
+ return new Money(b);
+ }
+
+ public Money add(Money amt, MathContext ctx) {
+ BigDecimal b = amount.add(amt.amount, ctx);
+ return new Money(b);
+ }
+
+ public Money multiply(Money m) {
+ return multiply(m.amount);
+ }
+
+ public Money multiply(int val) {
+ return multiply(BigDecimal.valueOf(val));
+ }
+
+ public Money multiply(float val) {
+ return multiply(BigDecimal.valueOf(val));
+ }
+
+ public Money multiply(double val) {
+ return multiply(BigDecimal.valueOf(val));
+ }
+
+ public Money multiply(BigDecimal m) {
+ BigDecimal b = amount.multiply(m);
+ return new Money(b);
+ }
+
+ public Money divide(BigDecimal divisor) {
+ BigDecimal b = amount.divide(divisor);
+ return new Money(b);
+ }
+
+ public Money divide(BigDecimal divisor, MathContext ctx) {
+ BigDecimal b = amount.divide(divisor, ctx);
+ return new Money(b);
+ }
+
+ public static Money sum(Money... m) {
+ BigDecimal t = BigDecimal.ZERO;
+ for (Money money : m) {
+ t = t.add(money.amount);
}
-
- public static Money sum(Iterator it){
- BigDecimal t = BigDecimal.ZERO;
- while (it.hasNext()) {
- t = t.add(it.next().amount);
- }
- return new Money(t);
+ return new Money(t);
+ }
+
+ public static Money sum(Iterator it) {
+ BigDecimal t = BigDecimal.ZERO;
+ while (it.hasNext()) {
+ t = t.add(it.next().amount);
}
-
- public static Money sum(Iterator it, MathContext ctx){
- BigDecimal t = BigDecimal.ZERO;
- while (it.hasNext()) {
- t = t.add(it.next().amount, ctx);
- }
- return new Money(t);
+ return new Money(t);
+ }
+
+ public static Money sum(Iterator it, MathContext ctx) {
+ BigDecimal t = BigDecimal.ZERO;
+ while (it.hasNext()) {
+ t = t.add(it.next().amount, ctx);
}
+ return new Money(t);
+ }
}
diff --git a/src/test/java/com/avaje/tests/model/ivo/Oid.java b/src/test/java/com/avaje/tests/model/ivo/Oid.java
index b28f4a3ed..6d8ebf808 100644
--- a/src/test/java/com/avaje/tests/model/ivo/Oid.java
+++ b/src/test/java/com/avaje/tests/model/ivo/Oid.java
@@ -3,43 +3,43 @@ package com.avaje.tests.model.ivo;
public class Oid {
- private final long value;
+ private final long value;
- public Oid(long value) {
- this.value = value;
- }
+ public Oid(long value) {
+ this.value = value;
+ }
- public String toString() {
- return String.valueOf(value);
- }
+ public String toString() {
+ return String.valueOf(value);
+ }
- public long getValue() {
- return value;
- }
+ public long getValue() {
+ return value;
+ }
- @Override
- public int hashCode() {
- return (int) (value ^ (value >>> 32));
- }
+ @Override
+ public int hashCode() {
+ return (int) (value ^ (value >>> 32));
+ }
- @Override
- public boolean equals(Object o) {
- if (o instanceof Oid>) {
- return ((Oid>) o).value == value;
- }
- return false;
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof Oid>) {
+ return ((Oid>) o).value == value;
}
+ return false;
+ }
- public static Oid> valueOf(String s) {
- return new Oid