/** * gets the argument for the current parsed option. For example, * in case of '-d <file>', if current option parsed is 'd' then * getOptionArg() would return '<file>'. * @return String - argument for current parsed option. */ public String getOptionArg(){ String retval = null; String tmp = theCurrentOption.getArgument(); char c = theCurrentOption.getArgLetter(); if(theOptionMatcher.hasArg(c)){ retval = tmp; } return retval; }
if(theOptionsIterator.hasNext()){ theCurrentOption = (Option)theOptionsIterator.next(); char c = theCurrentOption.getArgLetter(); boolean shouldHaveArg = theOptionMatcher.hasArg(c); String arg = theCurrentOption.getArgument(); if(!theOptionMatcher.match(c)) { ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, new Character(c)); throw (new IllegalArgumentException(msg.toString())); throw (new MissingOptArgException(msg.toString()));
/** * debugging routine to print out all options collected */ public void printOptions(){ for(ListIterator it=theOptions.listIterator(); it.hasNext();){ Option opt = (Option)it.next(); System.out.print("OPT =" + opt.getArgLetter()); String arg = opt.getArgument(); if(arg != null){ System.out.print(" " + arg); } System.out.println(); } }
int currOptIndex = 0; theCmdArgs = new ArrayList(); theOptionMatcher = new OptionMatcher(optString); theOptions.add(new Option(token.charAt(1))); theOptions.add(new Option(token.charAt(j))); indexoflast = theOptions.size()-1; Option op = (Option)theOptions.get(indexoflast); char opLetter = op.getArgLetter(); if(!op.hasArg() && theOptionMatcher.hasArg(opLetter)){ op.setArg(token);
boolean useStdIn = false; boolean classNameSet = false; final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv"); if (args.length < 1) printUsage(); while ((c = getopt.getNextOption()) != -1) { switch(c) { case 'i': break; case 'o': xsltc.setClassName(getopt.getOptionArg()); classNameSet = true; break; case 'd': xsltc.setDestDirectory(getopt.getOptionArg()); break; case 'p': xsltc.setPackageName(getopt.getOptionArg()); break; case 'j': xsltc.setJarFileName(getopt.getOptionArg()); break; case 'x': final String[] stylesheetNames = getopt.getCmdArgs(); final Vector stylesheetVector = new Vector(); for (int i = 0; i < stylesheetNames.length; i++) {
if(theOptionsIterator.hasNext()){ theCurrentOption = (Option)theOptionsIterator.next(); char c = theCurrentOption.getArgLetter(); boolean shouldHaveArg = theOptionMatcher.hasArg(c); String arg = theCurrentOption.getArgument(); if(!theOptionMatcher.match(c)) { ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, new Character(c)); throw (new IllegalArgumentException(msg.toString())); throw (new MissingOptArgException(msg.toString()));
int currOptIndex = 0; theCmdArgs = new ArrayList(); theOptionMatcher = new OptionMatcher(optString); theOptions.add(new Option(token.charAt(1))); theOptions.add(new Option(token.charAt(j))); indexoflast = theOptions.size()-1; Option op = (Option)theOptions.get(indexoflast); char opLetter = op.getArgLetter(); if(!op.hasArg() && theOptionMatcher.hasArg(opLetter)){ op.setArg(token);
boolean useStdIn = false; boolean classNameSet = false; final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv"); if (args.length < 1) printUsage(); while ((c = getopt.getNextOption()) != -1) { switch(c) { case 'i': break; case 'o': xsltc.setClassName(getopt.getOptionArg()); classNameSet = true; break; case 'd': xsltc.setDestDirectory(getopt.getOptionArg()); break; case 'p': xsltc.setPackageName(getopt.getOptionArg()); break; case 'j': xsltc.setJarFileName(getopt.getOptionArg()); break; case 'x': final String[] stylesheetNames = getopt.getCmdArgs(); final Vector stylesheetVector = new Vector(); for (int i = 0; i < stylesheetNames.length; i++) {
/** * gets the argument for the current parsed option. For example, * in case of '-d <file>', if current option parsed is 'd' then * getOptionArg() would return '<file>'. * @return String - argument for current parsed option. */ public String getOptionArg(){ String retval = null; String tmp = theCurrentOption.getArgument(); char c = theCurrentOption.getArgLetter(); if(theOptionMatcher.hasArg(c)){ retval = tmp; } return retval; }
/** * debugging routine to print out all options collected */ public void printOptions(){ for(ListIterator it=theOptions.listIterator(); it.hasNext();){ Option opt = (Option)it.next(); System.out.print("OPT =" + opt.getArgLetter()); String arg = opt.getArgument(); if(arg != null){ System.out.print(" " + arg); } System.out.println(); } }
if(theOptionsIterator.hasNext()){ theCurrentOption = (Option)theOptionsIterator.next(); char c = theCurrentOption.getArgLetter(); boolean shouldHaveArg = theOptionMatcher.hasArg(c); String arg = theCurrentOption.getArgument(); if(!theOptionMatcher.match(c)) { ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, new Character(c)); throw (new IllegalArgumentException(msg.toString())); throw (new MissingOptArgException(msg.toString()));
int currOptIndex = 0; theCmdArgs = new ArrayList(); theOptionMatcher = new OptionMatcher(optString); theOptions.add(new Option(token.charAt(1))); theOptions.add(new Option(token.charAt(j))); indexoflast = theOptions.size()-1; Option op = (Option)theOptions.get(indexoflast); char opLetter = op.getArgLetter(); if(!op.hasArg() && theOptionMatcher.hasArg(opLetter)){ op.setArg(token);
boolean useStdIn = false; boolean classNameSet = false; final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv"); if (args.length < 1) printUsage(); while ((c = getopt.getNextOption()) != -1) { switch(c) { case 'i': break; case 'o': xsltc.setClassName(getopt.getOptionArg()); classNameSet = true; break; case 'd': xsltc.setDestDirectory(getopt.getOptionArg()); break; case 'p': xsltc.setPackageName(getopt.getOptionArg()); break; case 'j': xsltc.setJarFileName(getopt.getOptionArg()); break; case 'x': final String[] stylesheetNames = getopt.getCmdArgs(); final Vector stylesheetVector = new Vector(); for (int i = 0; i < stylesheetNames.length; i++) {
/** * gets the argument for the current parsed option. For example, * in case of '-d <file>', if current option parsed is 'd' then * getOptionArg() would return '<file>'. * @return String - argument for current parsed option. */ public String getOptionArg(){ String retval = null; String tmp = theCurrentOption.getArgument(); char c = theCurrentOption.getArgLetter(); if(theOptionMatcher.hasArg(c)){ retval = tmp; } return retval; }
/** * debugging routine to print out all options collected */ public void printOptions(){ for(ListIterator it=theOptions.listIterator(); it.hasNext();){ Option opt = (Option)it.next(); System.out.print("OPT =" + opt.getArgLetter()); String arg = opt.getArgument(); if(arg != null){ System.out.print(" " + arg); } System.out.println(); } }
if(theOptionsIterator.hasNext()){ theCurrentOption = (Option)theOptionsIterator.next(); char c = theCurrentOption.getArgLetter(); boolean shouldHaveArg = theOptionMatcher.hasArg(c); String arg = theCurrentOption.getArgument(); if(!theOptionMatcher.match(c)) { ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, new Character(c)); throw (new IllegalArgumentException(msg.toString())); throw (new MissingOptArgException(msg.toString()));
int currOptIndex = 0; theCmdArgs = new ArrayList(); theOptionMatcher = new OptionMatcher(optString); theOptions.add(new Option(token.charAt(1))); theOptions.add(new Option(token.charAt(j))); indexoflast = theOptions.size()-1; Option op = (Option)theOptions.get(indexoflast); char opLetter = op.getArgLetter(); if(!op.hasArg() && theOptionMatcher.hasArg(opLetter)){ op.setArg(token);
boolean useStdIn = false; boolean classNameSet = false; final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv"); if (args.length < 1) printUsage(); while ((c = getopt.getNextOption()) != -1) { switch(c) { case 'i': break; case 'o': xsltc.setClassName(getopt.getOptionArg()); classNameSet = true; break; case 'd': xsltc.setDestDirectory(getopt.getOptionArg()); break; case 'p': xsltc.setPackageName(getopt.getOptionArg()); break; case 'j': xsltc.setJarFileName(getopt.getOptionArg()); break; case 'x': final String[] stylesheetNames = getopt.getCmdArgs(); final Vector stylesheetVector = new Vector(); for (int i = 0; i < stylesheetNames.length; i++) {
/** * gets the argument for the current parsed option. For example, * in case of '-d <file>', if current option parsed is 'd' then * getOptionArg() would return '<file>'. * @return String - argument for current parsed option. */ public String getOptionArg(){ String retval = null; String tmp = theCurrentOption.getArgument(); char c = theCurrentOption.getArgLetter(); if(theOptionMatcher.hasArg(c)){ retval = tmp; } return retval; }
/** * debugging routine to print out all options collected */ public void printOptions(){ for(ListIterator it=theOptions.listIterator(); it.hasNext();){ Option opt = (Option)it.next(); System.out.print("OPT =" + opt.getArgLetter()); String arg = opt.getArgument(); if(arg != null){ System.out.print(" " + arg); } System.out.println(); } }