Home | History | Annotate | Download | only in commands
      1 /**
      2  * $RCSfile$
      3  * $Revision$
      4  * $Date$
      5  *
      6  * Copyright 2008 Jive Software.
      7  *
      8  * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
      9  * you may not use this file except in compliance with the License.
     10  * You may obtain a copy of the License at
     11  *
     12  *     http://www.apache.org/licenses/LICENSE-2.0
     13  *
     14  * Unless required by applicable law or agreed to in writing, software
     15  * distributed under the License is distributed on an "AS IS" BASIS,
     16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     17  * See the License for the specific language governing permissions and
     18  * limitations under the License.
     19  */
     20 package org.jivesoftware.smackx.commands;
     21 
     22 /**
     23  * A factory for creating local commands. It's useful in cases where instantiation
     24  * of a command is more complicated than just using the default constructor. For example,
     25  * when arguments must be passed into the constructor or when using a dependency injection
     26  * framework. When a LocalCommandFactory isn't used, you can provide the AdHocCommandManager
     27  * a Class object instead. For more details, see
     28  * {@link AdHocCommandManager#registerCommand(String, String, LocalCommandFactory)}.
     29  *
     30  * @author Matt Tucker
     31  */
     32 public interface LocalCommandFactory {
     33 
     34     /**
     35      * Returns an instance of a LocalCommand.
     36      *
     37      * @return a LocalCommand instance.
     38      * @throws InstantiationException if creating an instance failed.
     39      * @throws IllegalAccessException if creating an instance is not allowed.
     40      */
     41     public LocalCommand getInstance() throws InstantiationException, IllegalAccessException;
     42 
     43 }