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.agenziaentrate.ivaservizi.docs.xsd.fatture.v1_0.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("RF04")
  40.     RF04 ("RF04"),
  41.     @javax.xml.bind.annotation.XmlEnumValue("RF05")
  42.     RF05 ("RF05"),
  43.     @javax.xml.bind.annotation.XmlEnumValue("RF06")
  44.     RF06 ("RF06"),
  45.     @javax.xml.bind.annotation.XmlEnumValue("RF07")
  46.     RF07 ("RF07"),
  47.     @javax.xml.bind.annotation.XmlEnumValue("RF08")
  48.     RF08 ("RF08"),
  49.     @javax.xml.bind.annotation.XmlEnumValue("RF09")
  50.     RF09 ("RF09"),
  51.     @javax.xml.bind.annotation.XmlEnumValue("RF10")
  52.     RF10 ("RF10"),
  53.     @javax.xml.bind.annotation.XmlEnumValue("RF11")
  54.     RF11 ("RF11"),
  55.     @javax.xml.bind.annotation.XmlEnumValue("RF12")
  56.     RF12 ("RF12"),
  57.     @javax.xml.bind.annotation.XmlEnumValue("RF13")
  58.     RF13 ("RF13"),
  59.     @javax.xml.bind.annotation.XmlEnumValue("RF14")
  60.     RF14 ("RF14"),
  61.     @javax.xml.bind.annotation.XmlEnumValue("RF15")
  62.     RF15 ("RF15"),
  63.     @javax.xml.bind.annotation.XmlEnumValue("RF16")
  64.     RF16 ("RF16"),
  65.     @javax.xml.bind.annotation.XmlEnumValue("RF17")
  66.     RF17 ("RF17"),
  67.     @javax.xml.bind.annotation.XmlEnumValue("RF19")
  68.     RF19 ("RF19"),
  69.     @javax.xml.bind.annotation.XmlEnumValue("RF18")
  70.     RF18 ("RF18");
  71.    
  72.    
  73.     /** Value */
  74.     private String value;
  75.     @Override
  76.     public String getValue()
  77.     {
  78.         return this.value;
  79.     }


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


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