mirror of
https://github.com/google/nomulus.git
synced 2025-05-24 21:20:08 +02:00
Improve BaseFee class and its children
Checks are added to ensure that fees are always non-negative, while credits are always negative, as required by the EPP fee extension specification. Also, BaseFee is made specifically abstract. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=131620110
This commit is contained in:
parent
8059ab5c90
commit
59ac00478e
3 changed files with 12 additions and 1 deletions
|
@ -14,6 +14,7 @@
|
|||
|
||||
package google.registry.model.domain.fee;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -41,6 +42,7 @@ public class Fee extends BaseFee {
|
|||
public static Fee create(BigDecimal cost, String description) {
|
||||
Fee instance = new Fee();
|
||||
instance.cost = checkNotNull(cost);
|
||||
checkArgument(instance.cost.signum() >= 0);
|
||||
instance.description = description;
|
||||
return instance;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue