1 /* $Id: ObjectCreationFactory.java 467222 2006-10-24 03:17:11Z markt $ 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one or more 4 * contributor license agreements. See the NOTICE file distributed with 5 * this work for additional information regarding copyright ownership. 6 * The ASF licenses this file to You under the Apache License, Version 2.0 7 * (the "License"); you may not use this file except in compliance with 8 * the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package org.apache.tomcat.util.digester; 20 21 22 import org.xml.sax.Attributes; 23 24 /** 25 * <p> Interface for use with {@link FactoryCreateRule}. 26 * The rule calls {@link #createObject} to create an object 27 * to be pushed onto the <code>Digester</code> stack 28 * whenever it is matched.</p> 29 * 30 * <p> {@link AbstractObjectCreationFactory} is an abstract 31 * implementation suitable for creating anonymous 32 * <code>ObjectCreationFactory</code> implementations. 33 */ 34 public interface ObjectCreationFactory { 35 36 /** 37 * <p>Factory method called by {@link FactoryCreateRule} to supply an 38 * object based on the element's attributes. 39 * 40 * @param attributes the element's attributes 41 * 42 * @throws Exception any exception thrown will be propagated upwards 43 */ 44 public Object createObject(Attributes attributes) throws Exception; 45 46 /** 47 * <p>Returns the {@link Digester} that was set by the 48 * {@link FactoryCreateRule} upon initialization. 49 */ 50 public Digester getDigester(); 51 52 /** 53 * <p>Set the {@link Digester} to allow the implementation to do logging, 54 * classloading based on the digester's classloader, etc. 55 * 56 * @param digester parent Digester object 57 */ 58 public void setDigester(Digester digester); 59 60 } 61