1 32 33 package com.jeantessier.commandline; 34 35 39 public class ToggleSwitch extends CommandLineSwitchBase { 40 public ToggleSwitch() { 41 this(false, false); 42 } 43 44 public ToggleSwitch(boolean defaultValue) { 45 this(defaultValue, false); 46 } 47 48 public ToggleSwitch(boolean defaultValue, boolean mandatory) { 49 super(new Boolean (defaultValue), mandatory); 50 } 51 52 public int parse(String name, String value) throws CommandLineException { 53 setValue(new Boolean (true)); 54 55 return 1; 56 } 57 58 public void accept(Visitor visitor) { 59 visitor.visitToggleSwitch(this); 60 } 61 } 62 | Popular Tags |