PrincipalReaderType.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.utils.transport.http.credential;

  21. import java.io.Serializable;

  22. /**
  23.  * Enum dei tipi di reader disponibili
  24.  *
  25.  * @author Pintori Giuliano (pintori@link.it)
  26.  * @author $Author$
  27.  * @version $Rev$, $Date$
  28.  */
  29. public enum PrincipalReaderType implements  Serializable , Cloneable {
  30.    
  31.     PRINCIPAL ("principal"),
  32.     HEADER ("header");

  33.     /** Value */
  34.     private String value;
  35.     public String getValue()
  36.     {
  37.         return this.value;
  38.     }

  39.     /** Official Constructor */
  40.     PrincipalReaderType(String value)
  41.     {
  42.         this.value = value;
  43.     }
  44.    
  45.     @Override
  46.     public String toString(){
  47.         return this.value;
  48.     }

  49.     public static boolean contains(String value){
  50.         return toEnumConstant(value)!=null;
  51.     }
  52.    
  53.     public static PrincipalReaderType toEnumConstant(String value){
  54.         PrincipalReaderType res = null;
  55.         for (PrincipalReaderType tmp : values()) {
  56.             if(tmp.getValue().equals(value)){
  57.                 res = tmp;
  58.                 break;
  59.             }
  60.         }
  61.         return res;
  62.     }
  63. }