Dead
[official-gcc.git] / gomp-20050608-branch / libjava / classpath / gnu / java / beans / decoder / ElementHandler.java
blobe6ae60af886c0a583563da2f53319df6b5455316
1 /* gnu.java.beans.decoder.ElementHandler
2 Copyright (C) 2004 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
38 package gnu.java.beans.decoder;
40 import java.beans.ExceptionListener;
42 import org.xml.sax.Attributes;
44 /** ElementHandler manages a Context instance and interacts with
45 * its parent and child handlers.
47 * @author Robert Schuster
49 interface ElementHandler
51 /** Evaluates the attributes and creates a Context instance.
52 * If the creation of the Context instance fails the ElementHandler
53 * is marked as failed which may affect the parent handler other.
55 * @param attributes Attributes of the XML tag.
57 void start(Attributes attributes, ExceptionListener exceptionListener);
59 /** Post-processes the Context.
61 void end(ExceptionListener exceptionListener);
63 /** Adds characters from the body of the XML tag to the buffer.
65 * @param ch
66 * @param start
67 * @param length
68 * @throws SAXException
70 void characters(char[] ch, int start, int length);
72 /** Returns whether a subelement of the given name is allowed. The rules
73 * for evaluating this are derived from the javabeans.dtd which can be found
74 * here: <a href="http://java.sun.com/products/jfc/tsc/articles/persistence3">Java Persistence Article</a>.
76 * @param subElementName
77 * @return
79 boolean isSubelementAllowed(String subElementName);
81 /** Provides the same functionality as Class.forName() but allows the decoder
82 * to use a different class loader.
84 * @param className
85 * @return
86 * @throws ClassNotFoundException
87 */
88 Class instantiateClass(String className) throws ClassNotFoundException;
90 /** Notifies the handler's Context that its child Context will not return
91 * a value back. Some Context variants need this information to know when
92 * a method or a constructor call can be made.
94 * This method is called by a child handler.
96 void notifyStatement(ExceptionListener exceptionListener);
98 /** Returns whether this handler has failed.
100 * This is used to skip child elements.
102 * @return Whether this handler has failed.
104 boolean hasFailed();
106 /** Returns the Context instance this handler is working on.
108 * @return The handler's Context instance.
110 Context getContext();
112 /** Notifies the handler that its Context failed and starts a recursive
113 * invocation of the parent handler if it is affected by that failure.
115 * Although the method is a public API member it is only used internally.
117 void notifyContextFailed();
119 /** Stores the object under the given id. The object is not stored if the
120 * id is null.
122 * @param objectId
123 * @param o
125 void putObject(String objectId, Object o);
127 Object getObject(String objectId) throws AssemblyException;
129 ElementHandler getParent();