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.unqualified;
019
020import java.io.Serializable;
021
022import javax.xml.bind.annotation.XmlAttribute;
023import javax.xml.bind.annotation.XmlSchemaType;
024import javax.xml.bind.annotation.XmlType;
025import javax.xml.bind.annotation.XmlValue;
026import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
027import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
028
029import io.konik.validator.annotation.NotBlank;
030
031/**
032 * = The Identifier.
033 */
034@XmlType(name = "IDType", propOrder = { "value" })
035public class ID implements Serializable {
036
037   @XmlValue
038   @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
039   @XmlSchemaType(name = "token")
040   private String value;
041
042   @XmlAttribute(name = "schemeID")
043   @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
044   @XmlSchemaType(name = "token")
045   private String schemeId;
046
047   /** Instantiates a new id. */
048   public ID() {
049   }
050
051   /**
052    * Instantiates a new id with value and a null scheme.
053    *
054    * @param value the value
055    */
056   public ID(String value) {
057      this.value = value;
058   }
059
060   /**
061    * Instantiates a new id with value and scheme id.
062    * 
063    * @param value the value
064    * @param schemeId the scheme id
065    */
066   public ID(String value, String schemeId) {
067      this.value = value;
068      this.schemeId = schemeId;
069   }
070
071   /**
072    * Gets the value.
073    * 
074    * @return the value
075    */
076   @NotBlank
077   public String getValue() {
078      return value;
079   }
080
081   /**
082    * Sets the value.
083    * 
084    * @param value the new value
085    */
086   public void setValue(String value) {
087      this.value = value;
088   }
089
090   /**
091    * Gets the scheme id.
092    * 
093    * @return the scheme id
094    */
095   public String getSchemeId() {
096      return schemeId;
097   }
098
099   /**
100    * Sets the scheme id.
101    * 
102    * @param schemeId the new scheme id
103    */
104   public void setSchemeId(String schemeId) {
105      this.schemeId = schemeId;
106   }
107}