001/** 002 * 003 * Copyright 2008 Jive Software. 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jivesoftware.smackx.commands; 018 019/** 020 * A factory for creating local commands. It's useful in cases where instantiation 021 * of a command is more complicated than just using the default constructor. For example, 022 * when arguments must be passed into the constructor or when using a dependency injection 023 * framework. When a LocalCommandFactory isn't used, you can provide the AdHocCommandManager 024 * a Class object instead. For more details, see 025 * {@link AdHocCommandManager#registerCommand(String, String, LocalCommandFactory)}. 026 * 027 * @author Matt Tucker 028 */ 029public interface LocalCommandFactory { 030 031 /** 032 * Returns an instance of a LocalCommand. 033 * 034 * @return a LocalCommand instance. 035 * @throws InstantiationException if creating an instance failed. 036 * @throws IllegalAccessException if creating an instance is not allowed. 037 */ 038 public LocalCommand getInstance() throws InstantiationException, IllegalAccessException; 039 040}