EsitoTransportContextIdentificationMode.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 org.openspcoop2.protocol.utils;

  21. /**
  22. * EsitoIdentificationMode
  23. *
  24. * @author Andrea Poli (apoli@link.it)
  25.  * @author $Author$
  26.  * @version $Rev$, $Date$
  27. */
  28. public enum EsitoTransportContextIdentificationMode {

  29.     EXISTS ("exists"),
  30.     MATCH ("match"),
  31.     CONTAINS ("contains"),
  32.     EQUALS ("equals");

  33.     private final String valore;

  34.     EsitoTransportContextIdentificationMode(String valore)
  35.     {
  36.         this.valore = valore;
  37.     }

  38.     public String getValore()
  39.     {
  40.         return this.valore;
  41.     }

  42.     public static String[] toStringArray(){
  43.         String[] res = new String[EsitoTransportContextIdentificationMode.values().length];
  44.         int i=0;
  45.         for (EsitoTransportContextIdentificationMode tmp : EsitoTransportContextIdentificationMode.values()) {
  46.             res[i]=tmp.getValore();
  47.             i++;
  48.         }
  49.         return res;
  50.     }
  51.     public static String[] toEnumNameArray(){
  52.         String[] res = new String[EsitoTransportContextIdentificationMode.values().length];
  53.         int i=0;
  54.         for (EsitoTransportContextIdentificationMode tmp : EsitoTransportContextIdentificationMode.values()) {
  55.             res[i]=tmp.name();
  56.             i++;
  57.         }
  58.         return res;
  59.     }


  60.     public static EsitoTransportContextIdentificationMode toEnumConstant(String val){

  61.         EsitoTransportContextIdentificationMode res = null;

  62.         if(EsitoTransportContextIdentificationMode.EXISTS.toString().equals(val)){
  63.             res = EsitoTransportContextIdentificationMode.EXISTS;
  64.         }else if(EsitoTransportContextIdentificationMode.MATCH.toString().equals(val)){
  65.             res = EsitoTransportContextIdentificationMode.MATCH;
  66.         }else if(EsitoTransportContextIdentificationMode.CONTAINS.toString().equals(val)){
  67.             res = EsitoTransportContextIdentificationMode.CONTAINS;
  68.         }else if(EsitoTransportContextIdentificationMode.EQUALS.toString().equals(val)){
  69.             res = EsitoTransportContextIdentificationMode.EQUALS;
  70.         }
  71.         return res;
  72.     }

  73.    
  74.     @Override
  75.     public String toString(){
  76.         return this.valore;
  77.     }
  78.     public boolean equals(String esito){
  79.         return this.toString().equals(esito);
  80.     }
  81.    
  82. }