Replace bulder of Money to Money.of
This commit is contained in:
parent
e31a80ec69
commit
d6eb56a3ad
@ -9,6 +9,7 @@ import cz.cvut.fel.sit.omo.foodchain.requirement.Requirement;
|
|||||||
import cz.cvut.fel.sit.omo.foodchain.signature.Signature;
|
import cz.cvut.fel.sit.omo.foodchain.signature.Signature;
|
||||||
import cz.cvut.fel.sit.omo.foodchain.signature.SignatureManager;
|
import cz.cvut.fel.sit.omo.foodchain.signature.SignatureManager;
|
||||||
import cz.cvut.fel.sit.omo.foodchain.util.ChannelObserver;
|
import cz.cvut.fel.sit.omo.foodchain.util.ChannelObserver;
|
||||||
|
import org.javamoney.moneta.Money;
|
||||||
|
|
||||||
import javax.money.Monetary;
|
import javax.money.Monetary;
|
||||||
import javax.money.MonetaryAmount;
|
import javax.money.MonetaryAmount;
|
||||||
@ -21,7 +22,7 @@ import java.util.Map;
|
|||||||
public class NodeBase implements ChannelObserver {
|
public class NodeBase implements ChannelObserver {
|
||||||
private final Map<ChannelBase, ChannelSubscriptionType> subscribedChannels;
|
private final Map<ChannelBase, ChannelSubscriptionType> subscribedChannels;
|
||||||
private final List<Product> products;
|
private final List<Product> products;
|
||||||
private MonetaryAmount money;
|
private final MonetaryAmount money;
|
||||||
|
|
||||||
private final List<Transaction> refusedTranslations;
|
private final List<Transaction> refusedTranslations;
|
||||||
|
|
||||||
@ -29,14 +30,14 @@ public class NodeBase implements ChannelObserver {
|
|||||||
subscribedChannels = new HashMap<>();
|
subscribedChannels = new HashMap<>();
|
||||||
products = new LinkedList<>();
|
products = new LinkedList<>();
|
||||||
refusedTranslations = new LinkedList<>();
|
refusedTranslations = new LinkedList<>();
|
||||||
money = Monetary.getDefaultAmountFactory().setCurrency("USD").setNumber(0).create();
|
money = Money.of(0, "USD");
|
||||||
}
|
}
|
||||||
|
|
||||||
public NodeBase(double m) {
|
public NodeBase(double m) {
|
||||||
subscribedChannels = new HashMap<>();
|
subscribedChannels = new HashMap<>();
|
||||||
products = new LinkedList<>();
|
products = new LinkedList<>();
|
||||||
refusedTranslations = new LinkedList<>();
|
refusedTranslations = new LinkedList<>();
|
||||||
money = Monetary.getDefaultAmountFactory().setCurrency("USD").setNumber(m).create();
|
money = Money.of(m, "USD");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package cz.cvut.fel.sit.omo.foodchain.product;
|
package cz.cvut.fel.sit.omo.foodchain.product;
|
||||||
|
|
||||||
import cz.cvut.fel.sit.omo.foodchain.operation.OperationBase;
|
import cz.cvut.fel.sit.omo.foodchain.operation.OperationBase;
|
||||||
|
import org.javamoney.moneta.Money;
|
||||||
|
|
||||||
import javax.money.Monetary;
|
import javax.money.Monetary;
|
||||||
import javax.money.MonetaryAmount;
|
import javax.money.MonetaryAmount;
|
||||||
@ -24,16 +25,15 @@ public class Product
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.productType = productType;
|
this.productType = productType;
|
||||||
this.productState = ProductState.AVAILABLE;
|
this.productState = ProductState.AVAILABLE;
|
||||||
this.money = Monetary.getDefaultAmountFactory().setCurrency("USD").setNumber(0).create();
|
this.money = Money.of(0, "USD");
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO money int constructor
|
|
||||||
public Product(String name, ProductType productType, double m)
|
public Product(String name, ProductType productType, double m)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.productType = productType;
|
this.productType = productType;
|
||||||
this.productState = ProductState.AVAILABLE;
|
this.productState = ProductState.AVAILABLE;
|
||||||
this.money = Monetary.getDefaultAmountFactory().setCurrency("USD").setNumber(m).create();
|
this.money = Money.of(m, "USD");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,7 +47,7 @@ public class Product
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.productType = productType;
|
this.productType = productType;
|
||||||
this.productState = productState;
|
this.productState = productState;
|
||||||
this.money = Monetary.getDefaultAmountFactory().setCurrency("USD").setNumber(0).create();
|
this.money = Money.of(0, "USD");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Product(String name, ProductType productType, ProductState productState, double m)
|
public Product(String name, ProductType productType, ProductState productState, double m)
|
||||||
@ -55,7 +55,7 @@ public class Product
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.productType = productType;
|
this.productType = productType;
|
||||||
this.productState = productState;
|
this.productState = productState;
|
||||||
this.money = Monetary.getDefaultAmountFactory().setCurrency("USD").setNumber(m).create();;
|
this.money = Money.of(m, "USD");
|
||||||
}
|
}
|
||||||
|
|
||||||
// "State machine methods"
|
// "State machine methods"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user