1 26 27 package org.objectweb.util.cmdline.lib; 28 29 import org.objectweb.util.cmdline.api.OptionFlag ; 30 31 39 40 public class DefaultOptionFlag 41 extends DefaultOptionBase 42 implements OptionFlag 43 { 44 50 51 protected boolean flag_; 52 53 59 65 public 66 DefaultOptionFlag() 67 { 68 this("", (String [])null, false); 69 } 70 71 79 public 80 DefaultOptionFlag(String label, 81 String description, 82 boolean flag) 83 { 84 this(new String [] { label }, description, flag); 85 } 86 87 95 public 96 DefaultOptionFlag(String [] labels, 97 String description, 98 boolean flag) 99 { 100 this(labels, new String [] { description }, flag); 101 } 102 103 111 public 112 DefaultOptionFlag(String label, 113 String [] description, 114 boolean flag) 115 { 116 this(new String [] { label }, description, flag); 117 } 118 119 127 public 128 DefaultOptionFlag(String [] labels, 129 String [] description, 130 boolean flag) 131 { 132 super(labels, new String [0], description); 133 setFlag(flag); 134 } 135 136 142 148 155 protected void 156 appendInternalState(StringBuffer sb) 157 { 158 super.appendInternalState(sb); 159 append(sb, "flag", getFlag()); 160 } 161 162 168 173 public void 174 consume(org.objectweb.util.cmdline.api.Iterator iterator) 175 { 176 checkAlreadySet(iterator); 177 flag_ = true; 178 } 179 180 186 191 public boolean 192 getFlag() 193 { 194 return flag_; 195 } 196 197 202 public void 203 setFlag(boolean flag) 204 { 205 flag_ = flag; 206 } 207 208 } 214 | Popular Tags |