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