1 25 package net.sf.javaguard; 26 27 28 29 30 34 public class ScriptEntry { 35 36 public static final int PUBLIC = 1; 37 38 public static final int PROTECTED = 2; 39 40 public static final int PRIVATE = 4; 41 42 public static final int FIELD = 8; 43 44 public static final int METHOD = 16; 45 46 47 50 private int type; 51 52 55 private String name; 56 57 58 private String descriptor; 59 60 63 private String mappedName; 64 65 67 private int attrs; 68 69 71 private String info; 72 73 74 75 76 80 public ScriptEntry(int type, String name) { 81 this(type, name, null); 82 } 83 84 85 90 public ScriptEntry(int type, String name, String descriptor) { 91 this(type, name, descriptor, null); 92 } 93 94 95 102 public ScriptEntry(int type, String name, String descriptor, String mappedName) { 103 this(type, name, descriptor, mappedName, 0); 104 } 105 106 107 115 public ScriptEntry(int type, String name, String descriptor, String mappedName, int attrs) { 116 this(type, name, descriptor, mappedName, attrs, null); 117 } 118 119 120 129 public ScriptEntry(int type, String name, String descriptor, String mappedName, 130 int attrs, String info) { 131 setType(type); 132 setName(name); 133 setDescriptor(descriptor); 134 setMappedName(mappedName); 135 setAttrs(attrs); 136 setInfo(info); 137 } 138 139 140 141 142 146 public void setType(int aType) { 147 this.type = aType; 148 } 149 150 151 155 public int getType() { 156 return type; 157 } 158 159 160 161 162 166 public void setName(String aName) { 167 this.name = aName; 168 } 169 170 171 175 public String getName() { 176 return name; 177 } 178 179 180 181 182 186 public void setDescriptor(String descriptor) { 187 this.descriptor = descriptor; 188 } 189 190 191 195 public String getDescriptor() { 196 return descriptor; 197 } 198 199 200 201 202 206 public void setMappedName(String name) { 207 this.mappedName = name; 208 } 209 210 211 215 public String getMappedName() { 216 return mappedName; 217 } 218 219 220 221 222 225 public void setAttrs(int attrs) { 226 this.attrs = attrs; 227 } 228 229 230 233 public int getAttrs() { 234 return attrs; 235 } 236 237 238 239 240 244 public void setRetainPublic(boolean canRetain) { 245 if (canRetain) { 246 setAttrs(getAttrs() | PUBLIC); 247 } else { 248 setAttrs(getAttrs() & ~PUBLIC); 249 } 250 } 251 252 253 257 public boolean canRetainPublic() { 258 return true == ((getAttrs() & PUBLIC) != 0); 259 } 260 261 262 263 264 268 public void setRetainProtected(boolean canRetain) { 269 if (canRetain) { 270 setAttrs(getAttrs() | PROTECTED); 271 } else { 272 setAttrs(getAttrs() & ~PROTECTED); 273 } 274 } 275 276 277 281 public boolean canRetainProtected() { 282 return true == ((getAttrs() & PROTECTED) != 0); 283 } 284 285 286 287 288 292 public void setRetainFields(boolean canRetain) { 293 if (canRetain) { 294 setAttrs(getAttrs() | FIELD); 295 } else { 296 setAttrs(getAttrs() & ~FIELD); 297 } 298 } 299 300 301 305 public boolean canRetainFields() { 306 return true == ((getAttrs() & FIELD) != 0); 307 } 308 309 310 311 312 316 public void setRetainMethods(boolean canRetain) { 317 if (canRetain) { 318 setAttrs(getAttrs() | METHOD); 319 } else { 320 setAttrs(getAttrs() & ~METHOD); 321 } 322 } 323 324 325 329 public boolean canRetainMethods() { 330 return true == ((getAttrs() & METHOD) != 0); 331 } 332 333 334 335 336 340 public void setInfo(String info) { 341 this.info = info; 342 } 343 344 345 349 public String getInfo() { 350 return info; 351 } 352 } 353 | Popular Tags |