Context.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.sdk;

  21. import java.io.Serializable;

  22. import org.openspcoop2.utils.Map;
  23. import org.openspcoop2.utils.MapKey;

  24. /**
  25.  * Context
  26.  *
  27.  *
  28.  * @author Poli Andrea (apoli@link.it)
  29.  * @author $Author$
  30.  * @version $Rev$, $Date$
  31.  */
  32. public class Context extends org.openspcoop2.utils.Map<Object> implements Serializable {
  33.    
  34.     /**
  35.      *
  36.      */
  37.     private static final long serialVersionUID = -2577197242840238762L;
  38.    
  39.    
  40.     // STATIC
  41.    
  42.       /**
  43.         * @deprecated (user method MapKey)
  44.         */
  45.     @Deprecated
  46.     public static String getValue(String key,Context pddContext){
  47.         if(key==null) {
  48.             return null;
  49.         }
  50.         return getValue(Map.newMapKey(key), pddContext);
  51.     }
  52.     public static String getValue(MapKey<String> key,Context pddContext){
  53.         String value = null;
  54.         if(pddContext!=null){
  55.             Object o = pddContext.getObject(key);
  56.             if(o instanceof String){
  57.                 value = (String) o;
  58.             }
  59.         }
  60.         return value;
  61.     }
  62.    
  63. }