1 16 17 package org.apache.axis2.wsdl.codegen; 18 19 import java.util.ArrayList ; 20 21 25 public class CommandLineOption implements CommandLineOptionConstants { 26 27 private String type; 28 private ArrayList optionValues; 29 private boolean invalid = false; 30 31 public CommandLineOption(String type, String [] values){ 32 updateType(type); 33 ArrayList arrayList = new ArrayList (values.length); 34 for(int i =0; i< values.length; i++){ 35 arrayList.add(values[i]); 36 } 37 this.optionValues = arrayList; 38 } 39 40 private void updateType(String type) { 41 if (type.startsWith("-")) type = type.replaceFirst("-",""); 42 type = type.toLowerCase(); 43 this.type = type; 44 } 45 46 49 public CommandLineOption(String type, ArrayList values) { 50 updateType(type); 51 this.validate(this.type); 52 53 if (null != values) { 54 this.optionValues = values ; 55 } 56 } 57 58 59 60 61 65 public String getType() { 66 return type; 67 } 68 69 70 73 public String getOptionValue() { 74 if (optionValues!=null) 75 return (String )optionValues.get(0); 76 else 77 return null; 78 } 79 80 83 public boolean isInvalid() { 84 return invalid; 85 } 86 87 88 91 public ArrayList getOptionValues() { 92 return optionValues; 93 } 94 95 private void validate(String optionType){ 96 invalid = !((WSDL_LOCATION_URI_OPTION).equalsIgnoreCase(optionType) || 97 (OUTPUT_LOCATION_OPTION).equalsIgnoreCase(optionType) || 98 (SERVER_SIDE_CODE_OPTION).equalsIgnoreCase(optionType) || 99 (CODEGEN_ASYNC_ONLY_OPTION).equalsIgnoreCase(optionType) || 100 (CODEGEN_SYNC_ONLY_OPTION).equalsIgnoreCase(optionType) || 101 (PACKAGE_OPTION).equalsIgnoreCase(optionType)|| 102 (GENERATE_SERVICE_DESCRIPTION_OPTION).equalsIgnoreCase(optionType)|| 103 (GENERATE_TEST_CASE_OPTION).equalsIgnoreCase(optionType)|| 104 (STUB_LANGUAGE_OPTION).equalsIgnoreCase(optionType)); 105 } 106 } | Popular Tags |