01: /*
02: * XML 2 Java Binding (X2JB) - the excellent Java tool.
03: * Copyright 2007, by Richard Opalka.
04: *
05: * This is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU Lesser General Public License as
07: * published by the Free Software Foundation; either version 2.1 of
08: * the License, or (at your option) any later version.
09: *
10: * This software is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this software; if not see the FSF site:
17: * http://www.fsf.org/ and search for the LGPL License document there.
18: */
19: package org.x2jb.bind.provider;
20:
21: import org.x2jb.bind.BindingException;
22:
23: /**
24: * Defines mapping of methods and interfaces to XML elements and attributes.
25: *
26: * @author <a href="mailto:richard_opalka@yahoo.com">Richard Opalka</a>
27: * @version 1.0
28: * @see org.x2jb.bind.provider.BindingFactory
29: */
30: public interface BindingDefinition {
31:
32: /**
33: * Local name of the node to which mapping applies
34: * @throws BindingException if a binding error occurs
35: * @return Local name of the node
36: */
37: String getNodeName() throws BindingException;
38:
39: /**
40: * Namespace of the node to which mapping applies - default is <code>null</code> representing no namespace
41: * @throws BindingException if a binding error occurs
42: * @return Namespace of the node
43: */
44: String getNodeNamespace() throws BindingException;
45:
46: /**
47: * Returns <code>true</code> if current node should be element node, <code>false</code> if it should be attribute node - default is <code>true</code>
48: * @throws BindingException if a binding error occurs
49: * @return Returns <code>true</code> if current node should be element node, <code>false</code> otherwise
50: */
51: boolean isElementNode() throws BindingException;
52:
53: /**
54: * Returns <code>true</code> if node must be present in XML document, <code>false</code> otherwise - default is <code>true</code>
55: * @throws BindingException if a binding error occurs
56: * @return Returns <code>true</code> if node must be present in XML document, <code>false</code> otherwise
57: */
58: boolean isNodeMandatory() throws BindingException;
59:
60: /**
61: * If current node (with specified optional namespace and local name)
62: * should be the only one in the context node this method will return
63: * <code>true</code>, otherwise it will return <code>false</code> - default is <code>true</code>
64: * @throws BindingException if a binding error occurs
65: * @return Returns <code>true</code> if current node should be the only one in the context node, <code>false</code> otherwise
66: */
67: boolean isNodeUnique() throws BindingException;
68:
69: /**
70: * Handler class to be used during the binding process or <code>null</code> forcing builtin handler to be used
71: * @throws BindingException if a binding error occurs
72: * @return Handler class name or <code>null</code> forcing builtin handler to be used
73: * @see org.x2jb.bind.handler.AttributeHandler
74: * @see org.x2jb.bind.handler.ElementHandler
75: */
76: Class getTypeHandler() throws BindingException;
77:
78: }
|