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;
20:
21: import java.lang.annotation.Retention;
22: import java.lang.annotation.RetentionPolicy;
23: import java.lang.annotation.Target;
24: import java.lang.annotation.ElementType;
25:
26: /**
27: * Defines mapping of methods to XML elements and attributes.
28: * Users using Java 5 or higher can use this annotation for binding definitions.
29: * Remember this annotation is not part of <b>XML 2 Java Binding</b> core jar.
30: * The annotation is located in <b>XML 2 Java Binding</b> annotation provider jar archive.
31: *
32: * @author <a href="mailto:richard_opalka@yahoo.com">Richard Opalka</a>
33: * @version 1.0
34: */
35: @Retention(RetentionPolicy.RUNTIME)
36: @Target({ElementType.METHOD})
37: public @interface Binding {
38:
39: /**
40: * Local name of the node to which mapping applies
41: */
42: String nodeName();
43:
44: /**
45: * Namespace of the node to which mapping applies
46: */
47: String nodeNamespace() default "";
48:
49: /**
50: * Node type to which mapping applies, if <code>true</code> the mapping applies to XML element,
51: * if <code>false</code> it applies to XML attribute
52: */
53: boolean isElementNode() default true;
54:
55: /**
56: * Returns <code>true</code> if current node (with specified optional namespace and local name)
57: * have to be the only one in the context node, <code>false</code> otherwise
58: */
59: boolean isNodeUnique() default true;
60:
61: /**
62: * Indicates whether current node must be present in XML document
63: */
64: boolean isNodeMandatory() default true;
65:
66: /**
67: * Handler class to be used to handle <b>XML 2 Java Binding</b> process.
68: * Default value <code>Void.class</code> is replaced with <code>null</code>
69: * value in annotation provider and this value indicates there is no user defined
70: * binding handler associated with the method.
71: */
72: Class typeHandler() default Void.class;
73:
74: }
|