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.entity;
020
021import io.konik.validator.annotation.NotBlank;
022import io.konik.validator.annotation.NotEmpty;
023import io.konik.zugferd.unqualified.Measure;
024
025import javax.validation.Valid;
026import javax.xml.bind.annotation.XmlElement;
027import javax.xml.bind.annotation.XmlType;
028import java.io.Serializable;
029import java.util.ArrayList;
030import java.util.List;
031
032/**
033 * The Class ProductCharacteristic.
034 */
035@XmlType(name = "ProductCharacteristicType", propOrder = { "typeCode", "description", "measurand", "value" })
036public class ProductCharacteristic implements Serializable {
037
038   @XmlElement(name = "TypeCode")
039   private String typeCode;
040
041   @XmlElement(name = "Description")
042   private List<String> description;
043
044   @XmlElement(name = "ValueMeasure")
045   private Measure measurand;
046
047   @XmlElement(name = "Value")
048   private String value;
049
050   /**
051    * Gets the type code.
052    *
053    * @return the type code
054    */
055   @NotBlank
056   public String getTypeCode() {
057      return typeCode;
058   }
059
060   /**
061    * Sets the type code.
062    *
063    * @param typeCode the type code
064    * @return the product characteristic
065    */
066   public ProductCharacteristic setTypeCode(String typeCode) {
067      this.typeCode = typeCode;
068      return this;
069   }
070
071   /**
072    * Gets the description.
073    *
074    * @return the description
075    */
076   @NotEmpty
077   public List<String> getDescription() {
078      if (description == null) {
079         description = new ArrayList<String>();
080      }
081      return description;
082   }
083
084   /**
085    * Sets the description.
086    *
087    * @param additionalDescription the description
088    * @return the product characteristic
089    */
090   public ProductCharacteristic addDescription(String additionalDescription) {
091      this.getDescription().add(additionalDescription);
092      return this;
093   }
094
095   /**
096    * Gets the measurand.
097    *
098    * @return the measurand
099    */
100   @Valid
101   public Measure getMeasurand() {
102      return measurand;
103   }
104
105   /**
106    * Sets the measurand.
107    *
108    * @param measurand the measurand
109    * @return the product characteristic
110    */
111   public ProductCharacteristic setMeasurand(Measure measurand) {
112      this.measurand = measurand;
113      return this;
114   }
115
116   /**
117    * Gets the value.
118    *
119    * @return the value
120    */
121   public String getValue() {
122      return value;
123   }
124
125   /**
126    * Sets the value.
127    *
128    * @param value the value
129    * @return the product characteristic
130    */
131   public ProductCharacteristic setValue(String value) {
132      this.value = value;
133      return this;
134   }
135
136}