FileDocCategorySizeDatePackage
MessageRetriever.javaAPI DocExample7534Wed Apr 19 11:17:18 BST 2000com.sun.tools.doclets

MessageRetriever

public class MessageRetriever extends Object
Retrieve and format messages stored in a resource.
since
JDK1.2
author
Atul M Dambalkar
author
Robert Field

Fields Summary
private ResourceBundle
messageRB
Constructors Summary
public MessageRetriever(String resourcelocation)
Initilize the ResourceBundle with the given resource.

param
resourcelocation Resource.

	try {
	    messageRB = ResourceBundle.getBundle(resourcelocation);
	} catch (MissingResourceException e) {
            throw new Error("Fatal: Resource for javadoc doclets is missing: "+
                             resourcelocation);
	}
    
public MessageRetriever(ResourceBundle rb)
Initilize the ResourceBundle with the given resource.

param
rb The ResourceBundle.

        messageRB = rb;
    
Methods Summary
public voiderror(java.lang.String key)
Print error message, increment error count.

param
key selects message from resource

 
        printError(getText(key)); 
    
public voiderror(java.lang.String key, java.lang.String a1)
Print error message, increment error count.

param
key selects message from resource
param
a1 first argument to be replaced in the message.

 
        printError(getText(key, a1)); 
    
public voiderror(java.lang.String key, java.lang.String a1, java.lang.String a2)
Print error message, increment error count.

param
key selects message from resource
param
a1 first argument to be replaced in the message.
param
a2 second argument to be replaced in the message.

 
        printError(getText(key, a1, a2)); 
    
public voiderror(java.lang.String key, java.lang.String a1, java.lang.String a2, java.lang.String a3)
Print error message, increment error count.

param
key selects message from resource
param
a1 first argument to be replaced in the message.
param
a2 second argument to be replaced in the message.
param
a3 third argument to be replaced in the message.

 
        printError(getText(key, a1, a2, a3)); 
    
public java.lang.StringgetText(java.lang.String key)
get and format message string from resource

param
key selects message from resource

	return getText(key, (String)null);
    
public java.lang.StringgetText(java.lang.String key, java.lang.String a1)
Get and format message string from resource

param
key selects message from resource
param
a1 Argument, to be repalced in the message.

	return getText(key, a1, null);
    
public java.lang.StringgetText(java.lang.String key, java.lang.String a1, java.lang.String a2)
Get and format message string from resource

param
key selects message from resource
param
a1 first argument to be replaced in the message.
param
a2 second argument to be replaced in the message.

	return getText(key, a1, a2, null);
    
public java.lang.StringgetText(java.lang.String key, java.lang.String a1, java.lang.String a2, java.lang.String a3)
Get and format message string from resource

param
key selects message from resource
param
a1 first argument to be replaced in the message.
param
a2 second argument to be replaced in the message.
param
a3 third argument to be replaced in the message.

	try {
	    String message = messageRB.getString(key);
	    String[] args = new String[3];
	    args[0] = a1;
	    args[1] = a2;
	    args[2] = a3;
	    return MessageFormat.format(message, args);
	} catch (MissingResourceException e) {
	    throw new Error("Fatal: Resource for javadoc is broken. There is no " + key + " key in resource.");
	}
    
public voidnotice(java.lang.String key)
Print a message.

param
key selects message from resource

 
        printNotice(getText(key)); 
    
public voidnotice(java.lang.String key, java.lang.String a1)
Print a message.

param
key selects message from resource
param
a1 first argument to be replaced in the message.

 
        printNotice(getText(key, a1)); 
    
public voidnotice(java.lang.String key, java.lang.String a1, java.lang.String a2)
Print a message.

param
key selects message from resource
param
a1 first argument to be replaced in the message.
param
a2 second argument to be replaced in the message.

 
        printNotice(getText(key, a1, a2)); 
    
public voidnotice(java.lang.String key, java.lang.String a1, java.lang.String a2, java.lang.String a3)
Print a message.

param
key selects message from resource
param
a1 first argument to be replaced in the message.
param
a2 second argument to be replaced in the message.
param
a3 third argument to be replaced in the message.

 
        printNotice(getText(key, a1, a2, a3)); 
    
static voidprintError(java.lang.String msg)
Print error message, increment error count.

param
msg message to print

	if (Configuration.root != null) {
            Configuration.root.printError(msg);
        } else {
            System.err.println(/* Main.program + ": " + */ msg);
        }
    
static voidprintNotice(java.lang.String msg)
Print a message.

param
msg message to print

	if (Configuration.root != null) {
            Configuration.root.printNotice(msg);
        } else {
            System.out.println(msg);
        }
    
static voidprintWarning(java.lang.String msg)
Print warning message, increment warning count.

param
msg message to print

	if (Configuration.root != null) {
            Configuration.root.printWarning(msg);
        } else {
            System.err.println(/* Main.program +  ": warning - " + */ "Warning: " + msg);
        }
    
public voidwarning(java.lang.String key)
Print warning message, increment warning count.

param
key selects message from resource

 
        printWarning(getText(key)); 
    
public voidwarning(java.lang.String key, java.lang.String a1)
Print warning message, increment warning count.

param
key selects message from resource
param
a1 first argument to be replaced in the message.

 
        printWarning(getText(key, a1)); 
    
public voidwarning(java.lang.String key, java.lang.String a1, java.lang.String a2)
Print warning message, increment warning count.

param
key selects message from resource
param
a1 first argument to be replaced in the message.
param
a2 second argument to be replaced in the message.

 
        printWarning(getText(key, a1, a2)); 
    
public voidwarning(java.lang.String key, java.lang.String a1, java.lang.String a2, java.lang.String a3)
Print warning message, increment warning count.

param
key selects message from resource
param
a1 first argument to be replaced in the message.
param
a2 second argument to be replaced in the message.
param
a3 third argument to be replaced in the message.

 
        printWarning(getText(key, a1, a2, a3));