001/* Copyright (C) 2014 konik.io 002 * 003 * This file is part of the Konik library. 004 * 005 * The Konik library is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Affero General Public License as 007 * published by the Free Software Foundation, either version 3 of the 008 * License, or (at your option) any later version. 009 * 010 * The Konik library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Affero General Public License for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License 016 * along with the Konik library. If not, see <http://www.gnu.org/licenses/>. 017 */ 018package io.konik.zugferd.entity; 019 020import io.konik.jaxb.adapter.AmountHighRoundingAdapter; 021import io.konik.validator.annotation.Comfort; 022import io.konik.zugferd.unqualified.Amount; 023import io.konik.zugferd.unqualified.Quantity; 024 025import java.util.List; 026 027import javax.validation.Valid; 028import javax.validation.constraints.NotNull; 029import javax.xml.bind.annotation.XmlAccessType; 030import javax.xml.bind.annotation.XmlAccessorType; 031import javax.xml.bind.annotation.XmlElement; 032import javax.xml.bind.annotation.XmlType; 033import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 034 035/** 036 * = The Price 037 * 038 * 039 */ 040@XmlAccessorType(XmlAccessType.FIELD) 041@XmlType(name = "TradePriceType", propOrder = { "chargeAmount", "basis", "allowanceCharges" }) 042public class Price { 043 044 @Valid 045 @NotNull(groups = Comfort.class) 046 @XmlElement(name = "ChargeAmount") 047 @XmlJavaTypeAdapter(value = AmountHighRoundingAdapter.class) 048 private Amount chargeAmount; 049 050 @Valid 051 @XmlElement(name = "BasisQuantity") 052 private Quantity basis; 053 054 @XmlElement(name = "AppliedTradeAllowanceCharge") 055 protected List<AllowanceCharge> allowanceCharges; 056 057 Price() { 058 } 059 060 /** 061 * Instantiates a new price. 062 * 063 * @param chargeAmount the charge amount 064 */ 065 public Price(Amount chargeAmount) { 066 super(); 067 this.chargeAmount = chargeAmount; 068 } 069 070 /** 071 * Gets the charge amount. 072 * 073 * @return the charge amount 074 */ 075 public Amount getChargeAmount() { 076 return chargeAmount; 077 } 078 079 /** 080 * Sets the charge amount. 081 * 082 * @param chargeAmount the new charge amount 083 * @return the price 084 */ 085 public Price setChargeAmount(Amount chargeAmount) { 086 this.chargeAmount = chargeAmount; 087 return this; 088 } 089 090 /** 091 * Gets the basis quantity. 092 * 093 * @return the basis quantity 094 */ 095 public Quantity getBasis() { 096 return basis; 097 } 098 099 /** 100 * Sets the basis quantity. 101 * 102 * @param quantity the new basis quantity 103 * @return the price 104 */ 105 public Price setBasis(Quantity quantity) { 106 this.basis = quantity; 107 return this; 108 } 109 110}