KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > bind > helpers > 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.helpers;
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 INPUTSTREAM_NOT_NULL = // 0 args
46
"AbstractUnmarshallerImpl.ISNotNull";
47         
48     static final String JavaDoc MUST_BE_BOOLEAN = // 1 arg
49
"AbstractMarshallerImpl.MustBeBoolean";
50        
51     static final String JavaDoc MUST_BE_STRING = // 1 arg
52
"AbstractMarshallerImpl.MustBeString";
53         
54     static final String JavaDoc SEVERITY_MESSAGE = // 3 args
55
"DefaultValidationEventHandler.SeverityMessage";
56
57     static final String JavaDoc LOCATION_UNAVAILABLE = // 0 args
58
"DefaultValidationEventHandler.LocationUnavailable";
59         
60     static final String JavaDoc UNRECOGNIZED_SEVERITY = // 1 arg
61
"DefaultValidationEventHandler.UnrecognizedSeverity";
62         
63     static final String JavaDoc WARNING = // 0 args
64
"DefaultValidationEventHandler.Warning";
65
66     static final String JavaDoc ERROR = // 0 args
67
"DefaultValidationEventHandler.Error";
68
69     static final String JavaDoc FATAL_ERROR = // 0 args
70
"DefaultValidationEventHandler.FatalError";
71         
72     static final String JavaDoc ILLEGAL_SEVERITY = // 0 args
73
"ValidationEventImpl.IllegalSeverity";
74         
75     static final String JavaDoc MUST_NOT_BE_NULL = // 1 arg
76
"Shared.MustNotBeNull";
77 }
78
Popular Tags