1 /* 2 * Copyright (C) 2011 The Libphonenumber Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.i18n.phonenumbers; 18 19 /** 20 * Abstract class defining a common interface for commands provided by build tools (e.g: commands to 21 * generate code or to download source files). 22 * 23 * <p> Subclass it to create a new command (e.g: code generation step). 24 * 25 * @author Philippe Liard 26 */ 27 public abstract class Command { 28 // The arguments provided to this command. The first one is the name of the command. 29 private String[] args; 30 31 /** 32 * Entry point of the command called by the CommandDispatcher when requested. This method must be 33 * implemented by subclasses. 34 */ start()35 public abstract boolean start(); 36 37 /** 38 * The name of the command is used by the CommandDispatcher to execute the requested command. The 39 * Dispatcher will pass along all command-line arguments to this command, so args[0] will be 40 * always the command name. 41 */ getCommandName()42 public abstract String getCommandName(); 43 getArgs()44 public String[] getArgs() { 45 return args; 46 } 47 setArgs(String[] args)48 public void setArgs(String[] args) { 49 this.args = args; 50 } 51 } 52