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 com.x2jb.bind.provider;
20:
21: import org.x2jb.bind.provider.BindingDefinition;
22: import org.x2jb.bind.BindingException;
23:
24: /**
25: * Binding implementation for Java resource bundles
26: *
27: * @author <a href="mailto:richard_opalka@yahoo.com">Richard Opalka</a>
28: * @version 1.0
29: */
30: final class PropertiesBindingImpl implements BindingDefinition {
31:
32: private final String nodeNamespace;
33: private final String nodeName;
34: private final boolean isElementNode;
35: private final boolean isNodeMandatory;
36: private final boolean isNodeUnique;
37: private final String typeHandler;
38:
39: PropertiesBindingImpl(String namespace, String name,
40: boolean isElement, boolean isMandatory, boolean isUnique,
41: String handler) {
42: this .nodeNamespace = namespace;
43: this .nodeName = name;
44: this .isElementNode = isElement;
45: this .isNodeMandatory = isMandatory;
46: this .typeHandler = handler;
47: this .isNodeUnique = isUnique;
48: }
49:
50: public final String getNodeNamespace() throws BindingException {
51: return this .nodeNamespace;
52: }
53:
54: public final String getNodeName() throws BindingException {
55: return this .nodeName;
56: }
57:
58: public final boolean isElementNode() throws BindingException {
59: return this .isElementNode;
60: }
61:
62: public final boolean isNodeMandatory() throws BindingException {
63: return this .isNodeMandatory;
64: }
65:
66: public final boolean isNodeUnique() throws BindingException {
67: return this .isNodeUnique;
68: }
69:
70: public final Class getTypeHandler() throws BindingException {
71: if (this .typeHandler == null)
72: return null;
73:
74: try {
75: return Class.forName(this .typeHandler);
76: } catch (ClassNotFoundException cnfe) {
77: throw new BindingException(cnfe.getMessage(), cnfe);
78: }
79: }
80:
81: }
|