1 22 package org.jboss.console.twiddle.command; 23 24 import org.jboss.util.NullArgumentException; 25 26 import org.jboss.logging.Logger; 27 28 35 public abstract class AbstractCommand 36 implements Command 37 { 38 protected Logger log = Logger.getLogger(getClass()); 39 40 protected final String desc; 41 42 protected final String name; 43 44 protected CommandContext context; 45 46 protected AbstractCommand(final String name, final String desc) 47 { 48 this.name = name; 49 this.desc = desc; 50 } 51 52 public String getName() 53 { 54 return name; 55 } 56 57 public String getDescription() 58 { 59 return desc; 60 } 61 62 public void setCommandContext(final CommandContext context) 63 { 64 if (context == null) 65 throw new NullArgumentException("context"); 66 67 this.context = context; 68 } 69 70 public void unsetCommandContext() 71 { 72 this.context = null; 73 } 74 75 80 public Object clone() 81 { 82 try 83 { 84 return super.clone(); 85 } 86 catch (CloneNotSupportedException e) 87 { 88 throw new InternalError (); 89 } 90 } 91 } 92 | Popular Tags |