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