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 */
018
019package io.konik.zugferd.unqualified;
020
021import io.konik.jaxb.adapter.MeasureRoundingAdapter;
022
023import javax.validation.constraints.Min;
024import javax.validation.constraints.NotNull;
025import javax.validation.constraints.Size;
026import javax.xml.bind.annotation.*;
027import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
028import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
029import java.io.Serializable;
030import java.math.BigDecimal;
031
032/**
033 * = The quantifying metric measure value and type
034 */
035@XmlAccessorType(XmlAccessType.FIELD)
036@XmlType(name = "MeasureType", propOrder = { "value" })
037public class Measure implements Serializable {
038
039   @XmlValue
040   @NotNull
041   @Min(0)
042   @XmlJavaTypeAdapter(MeasureRoundingAdapter.class)
043   private BigDecimal value;
044
045   /** The unit code. */
046   @XmlAttribute(name = "unitCode")
047   @Size(min = 1, max = 3)
048   @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
049   private String unitCode;
050
051   /**
052    * Gets the value.
053    *
054    * @return the value
055    */
056   public BigDecimal getValue() {
057      return value;
058   }
059
060   /**
061    * Sets the value.
062    *
063    * @param value the value
064    */
065   public void setValue(BigDecimal value) {
066      this.value = value;
067   }
068
069   /**
070    * Gets the unit code.
071    *
072    * @return the unit code
073    */
074   public String getUnitCode() {
075      return unitCode;
076   }
077
078   /**
079    * Sets the unit code.
080    *
081    * @param value the unit code
082    */
083   public void setUnitCode(String value) {
084      this.unitCode = value;
085   }
086
087}