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.util.Locale;
22: import java.util.ResourceBundle;
23:
24: /**
25: * Helper class for work with messages property file
26: *
27: * @author <a href="mailto:richard_opalka@yahoo.com">Richard Opalka</a>
28: * @version 1.0
29: */
30: final class Messages {
31:
32: /**
33: * Exception messages bundle
34: */
35: private static ResourceBundle exceptionsBundle = ResourceBundle
36: .getBundle("META-INF/exceptions", new Locale("en", "US"));
37:
38: /**
39: * Constructor
40: */
41: private Messages() {
42: super (); // no instances
43: }
44:
45: /**
46: * Returns localized property value
47: * @param key property key
48: * @return localized property value
49: */
50: public static String get(String key) {
51: return exceptionsBundle.getString(key);
52: }
53:
54: /**
55: * Keys to exception messages that are displayed
56: */
57: final static class BundleKey {
58:
59: /**
60: * Constructor
61: */
62: private BundleKey() {
63: // no instances
64: }
65:
66: public static final String METHOD_WRONG_NODE_VALUE = "method.wrong.node.value";
67: public static final String METHOD_CONTAINS_PARAMETERS = "method.contains.parameters";
68: public static final String METHOD_WITHOUT_METADATA = "method.without.metadata";
69: public static final String METHOD_FULL_NAME = "method.full.name";
70: public static final String VOID_METHOD_RETURN = "void.method.return";
71: public static final String MISSING_METADATA_FOR_IFACE = "missing.metadata.for.iface";
72: public static final String IFACE_MAPPED_TO_ATTRIBUTE = "iface.mapped.to.attribute";
73: public static final String METHOD_MANDATORY_ATTRIBUTE = "method.missing.attribute";
74: public static final String MISSING_REQUIRED_SUBELEMENT = "missing.required.subelement";
75: public static final String ARRAY_RETURN_TYPE_REQUIRED = "array.return.type.required";
76: public static final String METHOD_METADATA_MISMATCH = "method.metadata.mismatch";
77: public static final String UNABLE_TO_READ_PROPERTY_FILE = "unable.to.read.property.file";
78: public static final String UNABLE_TO_INSTANTIATE_HANDLER = "unable.to.instantiate.handler";
79: public static final String DEFAULT_HANDLER_NOT_FOUND = "default.handler.not.found";
80: public static final String CUSTOM_HANDLER_NOT_FOUND = "custom.handler.not.found";
81: public static final String NULL_METHOD_PARAMETERS = "null.method.parameters";
82: public static final String FACTORY_NOT_FOUND = "factory.not.found";
83: public static final String FACTORY_NOT_INSTATIATED = "factory.not.instantiated";
84: public static final String FACTORY_FOR_PROPERTY_NOT_FOUND = "factory.for.property.not.found";
85:
86: }
87:
88: }
|