java/sql-dk/src/info/globalcode/sql/dk/CLIParser.java
branchv_0
changeset 10 f528406f33f4
parent 9 2ec52027b97f
child 12 2dcb67d90fd2
equal deleted inserted replaced
9:2ec52027b97f 10:f528406f33f4
    37 			String arg = args[i];
    37 			String arg = args[i];
    38 			switch (arg) {
    38 			switch (arg) {
    39 				case Tokens.TYPES:
    39 				case Tokens.TYPES:
    40 					String typesString = fetchNext(args, ++i);
    40 					String typesString = fetchNext(args, ++i);
    41 
    41 
    42 					for (String oneType : typesString.split("\\s*,\\s*")) {
    42 					for (String oneType : typesString.split(",")) {
    43 						int sepatratorIndex = oneType.indexOf(TYPE_NAME_SEPARATOR);
    43 						int sepatratorIndex = oneType.indexOf(TYPE_NAME_SEPARATOR);
    44 						if (sepatratorIndex == -1) {
    44 						if (sepatratorIndex == -1) {
    45 							numberedTypes.add(getType(oneType));
    45 							numberedTypes.add(getType(oneType));
    46 						} else {
    46 						} else {
    47 							String namePart = oneType.substring(0, sepatratorIndex);
    47 							String namePart = oneType.substring(0, sepatratorIndex);
   125 		private Tokens() {
   125 		private Tokens() {
   126 		}
   126 		}
   127 	}
   127 	}
   128 
   128 
   129 	private int getType(String typeString) throws CLIParserException {
   129 	private int getType(String typeString) throws CLIParserException {
   130 		Integer type = types.get(typeString);
   130 		Integer type = types.get(typeString.trim());
   131 		if (type == null) {
   131 		if (type == null) {
   132 			throw new CLIParserException("Unsupported type: " + typeString);
   132 			throw new CLIParserException("Unsupported type: " + typeString);
   133 		} else {
   133 		} else {
   134 			return type;
   134 			return type;
   135 		}
   135 		}