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.NotEmpty;
022import io.konik.zugferd.unqualified.Code;
023
024import java.util.ArrayList;
025import java.util.List;
026
027import javax.validation.Valid;
028import javax.xml.bind.annotation.XmlAccessType;
029import javax.xml.bind.annotation.XmlAccessorType;
030import javax.xml.bind.annotation.XmlElement;
031import javax.xml.bind.annotation.XmlType;
032
033/**
034 * = The product classification.
035 */
036@XmlAccessorType(XmlAccessType.FIELD)
037@XmlType(name = "ProductClassificationType", propOrder = { "classCode", "classNames" })
038public class ProductClassification {
039
040   @Valid
041   @XmlElement(name = "ClassCode")
042   protected Code classCode;
043
044   @NotEmpty
045   @XmlElement(name = "ClassName")
046   protected List<String> classNames;
047
048   /**
049    * Gets the class code.
050    *
051    * @return the class code
052    */
053   public Code getClassCode() {
054      return classCode;
055   }
056
057   /**
058    * Sets the class code.
059    *
060    * @param value the class code
061    */
062   public void setClassCode(Code value) {
063      this.classCode = value;
064   }
065
066   /**
067    * Gets the class names.
068    *
069    * @return the class names
070    */
071   public List<String> getClassNames() {
072      if (classNames == null) {
073         classNames = new ArrayList<String>();
074      }
075      return this.classNames;
076   }
077
078   /**
079    * Adds the class names.
080    *
081    * @param className the class name
082    * @return the product classification
083    */
084   public ProductClassification addClassNames(String className) {
085      getClassNames().add(className);
086      return this;
087   }
088
089}