1 /* 2 * Copyright 2003 The Apache Software Foundation. 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 18 package org.apache.velocity.tools.view; 19 20 21 /** 22 * Interface to simplify and abstract tool handling. 23 * 24 * Implementations of this class should hold both the context 25 * key for the tool and sufficient information to return 26 * an instance of the tool. 27 * 28 * @author <a HREF="mailto:nathan@esha.com">Nathan Bubna</a> 29 * 30 * @version $Id: ToolInfo.java,v 1.3 2004/02/18 20:08:29 nbubna Exp $ 31 */ 32 public interface ToolInfo 33 { 34 35 36 /** 37 * @return the context key for the tool 38 */ 39 String getKey(); 40 41 42 /** 43 * @return the fully qualified classname for the tool 44 */ 45 String getClassname(); 46 47 48 /** 49 * Returns an instance of the tool. 50 * 51 * Instances returned may be new on each call, pooled, or 52 * the be same instance every time depending on the 53 * implementation. The object passed to this method may 54 * be used to initialize or create the tool that is returned, 55 * or it may be null if no such data is required. 56 * 57 * @param initData an object that may be used to initialize the instance 58 * @return an instance of the tool 59 */ 60 Object getInstance(Object initData); 61 62 63 } 64