org.openide.util 8.19.1

Annotation Type NbBundle.Messages

public static @interface NbBundle.Messages

Creates a helper class with static definitions of bundle keys.

The generated class will be called Bundle and be in the same package. Each key is placed in a file also in the same package, and the helper class gets a method with the same name as the key (converted to a valid Java identifier as needed) which loads the key from the (possibly now localized) bundle using NbBundle.getMessage(Class, String). The method will have as many arguments (of type Object) as there are message format parameters.

It is an error to duplicate a key within a package, even if the duplicates are from different compilation units.

Example usage:

 package some.where;
 import org.openide.util.NbBundle.Messages;
 import static some.where.Bundle.*;
 import org.openide.DialogDisplayer;
 import org.openide.NotifyDescriptor;
 class Something {
         "dialog.title=Bad File",
         "# {0} - file path",
         "dialog.message=The file {0} was invalid."
     void showError(File f) {
         NotifyDescriptor d = new NotifyDescriptor.Message(
             dialog_message(f), NotifyDescriptor.ERROR_MESSAGE);

which generates during compilation

 class Bundle {
     static String dialog_title() {...}
     static String dialog_message(Object file_path) {...}


 dialog.title=Bad File
 # {0} - file path
 dialog.message=The file {0} was invalid.

org.openide.util 8.10

Required Element Summary
 String[] value
          List of key/value pairs.

Element Detail


public abstract String[] value
List of key/value pairs. Each must be of the form key=Some Value. Anything is permitted in the value, including newlines. Unlike in a properties file, there should be no whitespace before the key or around the equals sign. Values containing {0} etc. are assumed to be message formats and so may need escapes for metacharacters such as '. A line may also be a comment if it starts with #, which may be useful for translators; it is recommended to use the format # {0} - summary of param.

org.openide.util 8.19.1

Built on December 7 2011.  |  Portions Copyright 1997-2011 Oracle. All rights reserved.