RegimeFiscaleType.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 RegimeFiscaleType 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 = "RegimeFiscaleType")
  33. @javax.xml.bind.annotation.XmlEnum(String.class)
  34. public enum RegimeFiscaleType implements IEnumeration , Serializable , Cloneable {

  35.     @javax.xml.bind.annotation.XmlEnumValue("RF01")
  36.     RF01 ("RF01"),
  37.     @javax.xml.bind.annotation.XmlEnumValue("RF02")
  38.     RF02 ("RF02"),
  39.     @javax.xml.bind.annotation.XmlEnumValue("RF03")
  40.     RF03 ("RF03"),
  41.     @javax.xml.bind.annotation.XmlEnumValue("RF04")
  42.     RF04 ("RF04"),
  43.     @javax.xml.bind.annotation.XmlEnumValue("RF05")
  44.     RF05 ("RF05"),
  45.     @javax.xml.bind.annotation.XmlEnumValue("RF06")
  46.     RF06 ("RF06"),
  47.     @javax.xml.bind.annotation.XmlEnumValue("RF07")
  48.     RF07 ("RF07"),
  49.     @javax.xml.bind.annotation.XmlEnumValue("RF08")
  50.     RF08 ("RF08"),
  51.     @javax.xml.bind.annotation.XmlEnumValue("RF09")
  52.     RF09 ("RF09"),
  53.     @javax.xml.bind.annotation.XmlEnumValue("RF10")
  54.     RF10 ("RF10"),
  55.     @javax.xml.bind.annotation.XmlEnumValue("RF11")
  56.     RF11 ("RF11"),
  57.     @javax.xml.bind.annotation.XmlEnumValue("RF12")
  58.     RF12 ("RF12"),
  59.     @javax.xml.bind.annotation.XmlEnumValue("RF13")
  60.     RF13 ("RF13"),
  61.     @javax.xml.bind.annotation.XmlEnumValue("RF14")
  62.     RF14 ("RF14"),
  63.     @javax.xml.bind.annotation.XmlEnumValue("RF15")
  64.     RF15 ("RF15"),
  65.     @javax.xml.bind.annotation.XmlEnumValue("RF16")
  66.     RF16 ("RF16"),
  67.     @javax.xml.bind.annotation.XmlEnumValue("RF17")
  68.     RF17 ("RF17"),
  69.     @javax.xml.bind.annotation.XmlEnumValue("RF19")
  70.     RF19 ("RF19"),
  71.     @javax.xml.bind.annotation.XmlEnumValue("RF18")
  72.     RF18 ("RF18");
  73.    
  74.    
  75.     /** Value */
  76.     private String value;
  77.     @Override
  78.     public String getValue()
  79.     {
  80.         return this.value;
  81.     }


  82.     /** Official Constructor */
  83.     RegimeFiscaleType(String value)
  84.     {
  85.         this.value = value;
  86.     }


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