DateEngineType.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.date;

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

  29.     JAVA_UTIL,
  30.     JAVA_TIME,
  31.     JODA;
  32.    
  33.     public DateType toDateTimeType() {
  34.         switch (this) {
  35.             case JAVA_UTIL:
  36.                 return DateType.JAVA_UTIL_DATE_TIME;
  37.             case JAVA_TIME:
  38.                 return DateType.JAVA_TIME_DATE_TIME;
  39.             case JODA:
  40.                 return DateType.JODA_DATE_TIME;
  41.         }
  42.         return null;
  43.     }
  44.    
  45.     public DateType toDateType() {
  46.         switch (this) {
  47.             case JAVA_UTIL:
  48.                 return DateType.JAVA_UTIL_DATE;
  49.             case JAVA_TIME:
  50.                 return DateType.JAVA_TIME_DATE;
  51.             case JODA:
  52.                 return DateType.JODA_DATE;
  53.         }
  54.         return null;
  55.     }
  56.    
  57.     public DateType toTimeType() {
  58.         switch (this) {
  59.             case JAVA_UTIL:
  60.                 return DateType.JAVA_UTIL_TIME;
  61.             case JAVA_TIME:
  62.                 return DateType.JAVA_TIME_TIME;
  63.             case JODA:
  64.                 return DateType.JODA_TIME;
  65.         }
  66.         return null;
  67.     }
  68.    
  69. }