PropertiesReader.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.pdd.core.dynamic;

  21. import org.slf4j.Logger;

  22. /**
  23.  * PropertiesReader
  24.  *
  25.  * @author Andrea Poli (apoli@link.it)
  26.  * @author $Author$
  27.  * @version $Rev$, $Date$
  28.  */
  29. public abstract class PropertiesReader {
  30.    
  31.     protected Logger log;
  32.    
  33.     protected PropertiesReader(Logger log) {
  34.         this.log = log;
  35.     }
  36.    
  37.     public boolean isExists(String nome) throws DynamicException {
  38.         return exists(nome);
  39.     }
  40.     public boolean exists(String nome) throws DynamicException {
  41.         String v = read(nome);
  42.         return v!=null;
  43.     }
  44.    
  45.     public boolean isEmpty(String nome) throws DynamicException {
  46.         String v = read(nome);
  47.         return v!=null && "".equals(v);
  48.     }
  49.    
  50.     public boolean isNotEmpty(String nome) throws DynamicException {
  51.         String v = read(nome);
  52.         return v!=null && !"".equals(v);
  53.     }
  54.    
  55.     public abstract String read(String nome) throws DynamicException;
  56.    
  57. }