ModalitaPagamentoType.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */
  20. package it.gov.fatturapa.sdi.fatturapa.v1_1.constants;

  21. import java.io.Serializable;
  22. import java.util.List;

  23. import org.openspcoop2.generic_project.beans.IEnumeration;
  24. import org.openspcoop2.generic_project.exception.NotFoundException;

  25. /**    
  26.  * Enumeration dell'elemento ModalitaPagamentoType xsd (tipo:string)
  27.  *
  28.  * @author Poli Andrea (poli@link.it)
  29.  * @author $Author$
  30.  * @version $Rev$, $Date$
  31.  */
  32. @javax.xml.bind.annotation.XmlType(name = "ModalitaPagamentoType")
  33. @javax.xml.bind.annotation.XmlEnum(String.class)
  34. public enum ModalitaPagamentoType implements IEnumeration , Serializable , Cloneable {

  35.     @javax.xml.bind.annotation.XmlEnumValue("MP01")
  36.     MP01 ("MP01"),
  37.     @javax.xml.bind.annotation.XmlEnumValue("MP02")
  38.     MP02 ("MP02"),
  39.     @javax.xml.bind.annotation.XmlEnumValue("MP03")
  40.     MP03 ("MP03"),
  41.     @javax.xml.bind.annotation.XmlEnumValue("MP04")
  42.     MP04 ("MP04"),
  43.     @javax.xml.bind.annotation.XmlEnumValue("MP05")
  44.     MP05 ("MP05"),
  45.     @javax.xml.bind.annotation.XmlEnumValue("MP06")
  46.     MP06 ("MP06"),
  47.     @javax.xml.bind.annotation.XmlEnumValue("MP07")
  48.     MP07 ("MP07"),
  49.     @javax.xml.bind.annotation.XmlEnumValue("MP08")
  50.     MP08 ("MP08"),
  51.     @javax.xml.bind.annotation.XmlEnumValue("MP09")
  52.     MP09 ("MP09"),
  53.     @javax.xml.bind.annotation.XmlEnumValue("MP10")
  54.     MP10 ("MP10"),
  55.     @javax.xml.bind.annotation.XmlEnumValue("MP11")
  56.     MP11 ("MP11"),
  57.     @javax.xml.bind.annotation.XmlEnumValue("MP12")
  58.     MP12 ("MP12"),
  59.     @javax.xml.bind.annotation.XmlEnumValue("MP13")
  60.     MP13 ("MP13"),
  61.     @javax.xml.bind.annotation.XmlEnumValue("MP14")
  62.     MP14 ("MP14"),
  63.     @javax.xml.bind.annotation.XmlEnumValue("MP15")
  64.     MP15 ("MP15"),
  65.     @javax.xml.bind.annotation.XmlEnumValue("MP16")
  66.     MP16 ("MP16"),
  67.     @javax.xml.bind.annotation.XmlEnumValue("MP17")
  68.     MP17 ("MP17"),
  69.     @javax.xml.bind.annotation.XmlEnumValue("MP18")
  70.     MP18 ("MP18"),
  71.     @javax.xml.bind.annotation.XmlEnumValue("MP19")
  72.     MP19 ("MP19"),
  73.     @javax.xml.bind.annotation.XmlEnumValue("MP20")
  74.     MP20 ("MP20"),
  75.     @javax.xml.bind.annotation.XmlEnumValue("MP21")
  76.     MP21 ("MP21");
  77.    
  78.    
  79.     /** Value */
  80.     private String value;
  81.     @Override
  82.     public String getValue()
  83.     {
  84.         return this.value;
  85.     }


  86.     /** Official Constructor */
  87.     ModalitaPagamentoType(String value)
  88.     {
  89.         this.value = value;
  90.     }


  91.    
  92.     @Override
  93.     public String toString(){
  94.         return this.value;
  95.     }
  96.     public boolean equals(String object){
  97.         if(object==null)
  98.             return false;
  99.         return object.equals(this.getValue());  
  100.     }
  101.    
  102.        
  103.    
  104.     /** compatibility with the generated bean (reflection) */
  105.     public boolean equals(Object object,List<String> fieldsNotCheck){
  106.         if( !(object instanceof ModalitaPagamentoType) ){
  107.             java.lang.StringBuilder sb = new java.lang.StringBuilder();
  108.             if(fieldsNotCheck!=null && !fieldsNotCheck.isEmpty()){
  109.                 sb.append(" (fieldsNotCheck: ").append(fieldsNotCheck).append(")");
  110.             }
  111.             throw new org.openspcoop2.utils.UtilsRuntimeException("Wrong type"+sb.toString()+": "+object.getClass().getName());
  112.         }
  113.         return this.equals(object);
  114.     }
  115.     private String toStringEngine(Object object,boolean reportHTML,List<String> fieldsNotIncluded, StringBuilder bf){
  116.         java.lang.StringBuilder sb = new java.lang.StringBuilder();
  117.         if(reportHTML){
  118.             sb.append(" (reportHTML)");
  119.         }
  120.         if(fieldsNotIncluded!=null && !fieldsNotIncluded.isEmpty()){
  121.             sb.append(" (fieldsNotIncluded: ").append(fieldsNotIncluded).append(")");
  122.         }
  123.         if(object!=null){
  124.             sb.append(" (object: ").append(object.getClass().getName()).append(")");
  125.         }
  126.         if(sb.length()>0) {
  127.             bf.append(sb.toString());
  128.         }
  129.         return sb.length()>0 ? this.toString()+sb.toString() : this.toString();
  130.     }
  131.     public String toString(boolean reportHTML){
  132.         return toStringEngine(null, reportHTML, null, null);
  133.     }
  134.     public String toString(boolean reportHTML,List<String> fieldsNotIncluded){
  135.         return toStringEngine(null, reportHTML, fieldsNotIncluded, null);
  136.     }
  137.     public String diff(Object object,StringBuilder bf,boolean reportHTML){
  138.         return toStringEngine(object, reportHTML, null, bf);
  139.     }
  140.     public String diff(Object object,StringBuilder bf,boolean reportHTML,List<String> fieldsNotIncluded){
  141.         return toStringEngine(object, reportHTML, fieldsNotIncluded, bf);
  142.     }
  143.    
  144.    
  145.     /** Utilities */
  146.    
  147.     public static String[] toArray(){
  148.         String[] res = new String[values().length];
  149.         int i=0;
  150.         for (ModalitaPagamentoType tmp : values()) {
  151.             res[i]=tmp.getValue();
  152.             i++;
  153.         }
  154.         return res;
  155.     }  
  156.     public static String[] toStringArray(){
  157.         String[] res = new String[values().length];
  158.         int i=0;
  159.         for (ModalitaPagamentoType tmp : values()) {
  160.             res[i]=tmp.toString();
  161.             i++;
  162.         }
  163.         return res;
  164.     }
  165.     public static String[] toEnumNameArray(){
  166.         String[] res = new String[values().length];
  167.         int i=0;
  168.         for (ModalitaPagamentoType tmp : values()) {
  169.             res[i]=tmp.name();
  170.             i++;
  171.         }
  172.         return res;
  173.     }
  174.    
  175.     public static boolean contains(String value){
  176.         return toEnumConstant(value)!=null;
  177.     }
  178.    
  179.     public static ModalitaPagamentoType toEnumConstant(String value){
  180.         try{
  181.             return toEnumConstant(value,false);
  182.         }catch(NotFoundException notFound){
  183.             return null;
  184.         }
  185.     }
  186.     public static ModalitaPagamentoType toEnumConstant(String value, boolean throwNotFoundException) throws NotFoundException{
  187.         ModalitaPagamentoType res = null;
  188.         for (ModalitaPagamentoType tmp : values()) {
  189.             if(tmp.getValue().equals(value)){
  190.                 res = tmp;
  191.                 break;
  192.             }
  193.         }
  194.         if(res==null && throwNotFoundException){
  195.             throw new NotFoundException("Enum with value ["+value+"] not found");
  196.         }
  197.         return res;
  198.     }
  199.    
  200.     public static IEnumeration toEnumConstantFromString(String value){
  201.         try{
  202.             return toEnumConstantFromString(value,false);
  203.         }catch(NotFoundException notFound){
  204.             return null;
  205.         }
  206.     }
  207.     public static IEnumeration toEnumConstantFromString(String value, boolean throwNotFoundException) throws NotFoundException{
  208.         ModalitaPagamentoType res = null;
  209.         for (ModalitaPagamentoType tmp : values()) {
  210.             if(tmp.toString().equals(value)){
  211.                 res = tmp;
  212.                 break;
  213.             }
  214.         }
  215.         if(res==null && throwNotFoundException){
  216.             throw new NotFoundException("Enum with value ["+value+"] not found");
  217.         }
  218.         return res;
  219.     }
  220. }