KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > bind > Messages


1 /*
2  * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
3  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4  */

5
6 package javax.xml.bind;
7
8 import java.text.MessageFormat JavaDoc;
9 import java.util.ResourceBundle JavaDoc;
10
11 /**
12  * Formats error messages.
13  */

14 class Messages
15 {
16     static String JavaDoc format( String JavaDoc property ) {
17         return format( property, null );
18     }
19     
20     static String JavaDoc format( String JavaDoc property, Object JavaDoc arg1 ) {
21         return format( property, new Object JavaDoc[]{arg1} );
22     }
23     
24     static String JavaDoc format( String JavaDoc property, Object JavaDoc arg1, Object JavaDoc arg2 ) {
25         return format( property, new Object JavaDoc[]{arg1,arg2} );
26     }
27     
28     static String JavaDoc format( String JavaDoc property, Object JavaDoc arg1, Object JavaDoc arg2, Object JavaDoc arg3 ) {
29         return format( property, new Object JavaDoc[]{arg1,arg2,arg3} );
30     }
31     
32     // add more if necessary.
33

34     /** Loads a string resource and formats it with specified arguments. */
35     static String JavaDoc format( String JavaDoc property, Object JavaDoc[] args ) {
36         String JavaDoc text = ResourceBundle.getBundle(Messages.class.getName()).getString(property);
37         return MessageFormat.format(text,args);
38     }
39     
40 //
41
//
42
// Message resources
43
//
44
//
45
static final String JavaDoc PROVIDER_NOT_FOUND = // 1 arg
46
"ContextFinder.ProviderNotFound";
47
48     static final String JavaDoc COULD_NOT_INSTANTIATE = // 2 args
49
"ContextFinder.CouldNotInstantiate";
50         
51     static final String JavaDoc CANT_FIND_PROPERTIES_FILE = // 1 arg
52
"ContextFinder.CantFindPropertiesFile";
53         
54     static final String JavaDoc CANT_MIX_PROVIDERS = // 0 args
55
"ContextFinder.CantMixProviders";
56         
57     static final String JavaDoc MISSING_PROPERTY = // 2 args
58
"ContextFinder.MissingProperty";
59
60     static final String JavaDoc NO_PACKAGE_IN_CONTEXTPATH = // 0 args
61
"ContextFinder.NoPackageInContextPath";
62
63     static final String JavaDoc NAME_VALUE = // 2 args
64
"PropertyException.NameValue";
65         
66     static final String JavaDoc CONVERTER_MUST_NOT_BE_NULL = // 0 args
67
"DatatypeConverter.ConverterMustNotBeNull";
68
69     static final String JavaDoc ILLEGAL_CAST = // 2 args
70
"JAXBContext.IllegalCast";
71 }
72
Popular Tags