001 package org.hackystat.sensor.xmldata.option; 002 003 import java.util.List; 004 005 import org.hackystat.sensor.xmldata.XmlDataController; 006 007 /** 008 * The option called when the user wishes to display additional information that 009 * is useful when debugging. 010 * @author aito 011 * 012 */ 013 public class VerboseOption extends AbstractOption { 014 /** The option name, which is "-verbose". */ 015 public static final String OPTION_NAME = "-verbose"; 016 017 /** 018 * Creates this option with the specified controller and the specified list of 019 * parameters. 020 * @param controller the specified controller. 021 * @param parameters the specified list of parameters. 022 */ 023 public VerboseOption(XmlDataController controller, List<String> parameters) { 024 super(controller, OPTION_NAME, parameters); 025 } 026 027 /** Processes this option by setting the verbose mode to true. */ 028 @Override 029 public void process() { 030 if (this.isValid()) { 031 this.getController().addOptionObject(Options.VERBOSE, Boolean.TRUE); 032 } 033 } 034 035 /** 036 * Returns true if this option is valid. This option is valid if no parameters 037 * are specified. 038 * @return true if this argument has not parameters. 039 */ 040 @Override 041 public boolean isValid() { 042 if (!this.getParameters().isEmpty()) { 043 String msg = "The " + OPTION_NAME + " option does not accept arguments. "; 044 this.getController().fireMessage(msg); 045 return false; 046 } 047 return true; 048 } 049 }