DBVIEW
|
00001 /* 00002 DbView - Graph Visualization 00003 Copyright (C) 2012 Denis BEURIVE 00004 00005 This program is free software: you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation, either version 3 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 /** 00020 * @author Denis Beurive 00021 */ 00022 00023 package org.dbview.adapter; 00024 00025 /** 00026 * class CliParameterTypes This class contains types' indicators for command 00027 * line options. 00028 * 00029 * @author Denis BEURIVE 00030 */ 00031 public class CliParameterTypes 00032 { 00033 /** The parameter's type is not defined. */ 00034 public static final int UNDEFINED = -1; 00035 /** The parameter is a string. */ 00036 public static final int STRING = 0; 00037 /** The parameter is an integer. */ 00038 public static final int INTEGER = 1; 00039 /** The parameter is a boolean. */ 00040 public static final int BOOLEAN = 2; 00041 /** The parameter is a double. */ 00042 public static final int DOUBLE = 3; 00043 /** The parameter is a long. */ 00044 public static final int LONG = 4; 00045 00046 /** 00047 * This method generates a textual representation of a given parameter's type. 00048 * @param in_constant Parametor's type. 00049 * @return The method returns a textual representation of the given parameter's type. 00050 * @throws Exception 00051 */ 00052 public static String toString(int in_constant) throws Exception 00053 { 00054 if (CliParameterTypes.UNDEFINED == in_constant) 00055 { 00056 return "undefined"; 00057 } 00058 if (CliParameterTypes.STRING == in_constant) 00059 { 00060 return "string"; 00061 } 00062 if (CliParameterTypes.INTEGER == in_constant) 00063 { 00064 return "integer"; 00065 } 00066 if (CliParameterTypes.BOOLEAN == in_constant) 00067 { 00068 return "boolean"; 00069 } 00070 if (CliParameterTypes.DOUBLE == in_constant) 00071 { 00072 return "double"; 00073 } 00074 if (CliParameterTypes.LONG == in_constant) 00075 { 00076 return "long"; 00077 } 00078 throw new Exception("Unexpected type of CLI parameter: " + in_constant); 00079 } 00080 }