Java Doc for NbBundle.java in  » IDE-Netbeans » openide » org » openide » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » openide » org.openide.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.openide.util.NbBundle

NbBundle
public class NbBundle extends Object (Code)
Convenience class permitting easy loading of localized resources of various sorts. Extends the functionality of the default Java resource support, and interacts better with class loaders in a multiple-loader system.

Example usage:

 package com.mycom;
 public class Foo {
 // Search for tag Foo_theMessage in /com/mycom/Bundle.properties:
 private static String theMessage = 
NbBundle.getMessage(ClassString) NbBundle.getMessage  (Foo.class, "Foo_theMessage");
 // Might also look in /com/mycom/Bundle_de.properties, etc.
 }
 

Inner Class :public static interface ClassLoaderFinder
Inner Class :final static class DebugLoader extends ClassLoader

Field Summary
final static  Map<ClassLoader, Map<String, Reference<ResourceBundle>>>bundleCache
     Cache of resource bundles.
final static  Map<ClassLoader, Map<String, URL>>localizedFileCache
     Cache of URLs for localized files.

Constructor Summary
public  NbBundle()
     Do not call.

Method Summary
public static  StringgetBranding()
     Get the current branding token.
final public static  ResourceBundlegetBundle(String baseName)
     Get a resource bundle with the default class loader and locale/branding. Caution: NbBundle.getBundle(Class) is generally safer when used from a module as this method relies on the module's classloader to currently be part of the system classloader.
public static  ResourceBundlegetBundle(Class clazz)
     Get a resource bundle in the same package as the provided class, with the default locale/branding and the class' own classloader.
final public static  ResourceBundlegetBundle(String baseName, Locale locale)
     Get a resource bundle with the default class loader and branding.
final public static  ResourceBundlegetBundle(String baseName, Locale locale, ClassLoader loader)
     Get a resource bundle the hard way.
public static synchronized  URLgetLocalizedFile(String baseName, String ext)
     Get a localized and/or branded file in the default locale with the default class loader.

Note that use of this call is similar to using the URL protocol nbresloc (which may in fact be implemented using the fuller form of the method).

The extension may be null, in which case no final dot will be appended. If it is the empty string, the resource will end in a dot.
Parameters:
  baseName - base name of file, as dot-separated path (e.g.

public static synchronized  URLgetLocalizedFile(String baseName, String ext, Locale locale)
     Get a localized and/or branded file with the default class loader.
Parameters:
  baseName - base name of file, as dot-separated path (e.g.
public static synchronized  URLgetLocalizedFile(String baseName, String ext, Locale locale, ClassLoader loader)
     Get a localized and/or branded file.
Parameters:
  baseName - base name of file, as dot-separated path (e.g.
public static  TgetLocalizedValue(Map<String, T> table, String key, Locale locale)
     Find a localized and/or branded value for a given key and locale. Scans through a map to find the most localized match possible.
public static  TgetLocalizedValue(Map<String, T> table, String key)
     Find a localized and/or branded value for a given key in the default system locale.
public static  StringgetLocalizedValue(Attributes attr, Attributes.Name key, Locale locale)
     Find a localized and/or branded value in a JAR manifest.
public static  StringgetLocalizedValue(Attributes attr, Attributes.Name key)
     Find a localized and/or branded value in a JAR manifest in the default system locale.
public static  Iterator<String>getLocalizingSuffixes()
     Get a list of all suffixes used to search for localized/branded resources.
public static  StringgetMessage(Class clazz, String resName)
     Finds a localized and/or branded string in a bundle.
public static  StringgetMessage(Class clazz, String resName, Object param1)
     Finds a localized and/or branded string in a bundle and formats the message by passing requested parameters.
public static  StringgetMessage(Class clazz, String resName, Object param1, Object param2)
     Finds a localized and/or branded string in a bundle and formats the message by passing requested parameters.
public static  StringgetMessage(Class clazz, String resName, Object param1, Object param2, Object param3)
     Finds a localized and/or branded string in a bundle and formats the message by passing requested parameters.
public static  StringgetMessage(Class clazz, String resName, Object[] arr)
     Finds a localized and/or branded string in a bundle and formats the message by passing requested parameters.
public static  voidsetBranding(String bt)
     Set the current branding token.
public static  voidsetClassLoaderFinder(ClassLoaderFinder loaderFinder)
     Do not use.

Field Detail
bundleCache
final static Map<ClassLoader, Map<String, Reference<ResourceBundle>>> bundleCache(Code)
Cache of resource bundles.



localizedFileCache
final static Map<ClassLoader, Map<String, URL>> localizedFileCache(Code)
Cache of URLs for localized files. Keeps only weak references to the class loaders.
See Also:    "#9275"




Constructor Detail
NbBundle
public NbBundle()(Code)
Do not call.




Method Detail
getBranding
public static String getBranding()(Code)
Get the current branding token. the branding, or null for none



getBundle
final public static ResourceBundle getBundle(String baseName) throws MissingResourceException(Code)
Get a resource bundle with the default class loader and locale/branding. Caution: NbBundle.getBundle(Class) is generally safer when used from a module as this method relies on the module's classloader to currently be part of the system classloader. NetBeans does add enabled modules to this classloader, however calls to this variant of the method made in ModuleInstall.validate, or made soon after a module is uninstalled (due to background threads) could fail unexpectedly.
Parameters:
  baseName - bundle basename the resource bundle
exception:
  MissingResourceException - if the bundle does not exist



getBundle
public static ResourceBundle getBundle(Class clazz) throws MissingResourceException(Code)
Get a resource bundle in the same package as the provided class, with the default locale/branding and the class' own classloader. This is the usual style of invocation.
Parameters:
  clazz - the class to take the package name from the resource bundle
exception:
  MissingResourceException - if the bundle does not exist



getBundle
final public static ResourceBundle getBundle(String baseName, Locale locale) throws MissingResourceException(Code)
Get a resource bundle with the default class loader and branding.
Parameters:
  baseName - bundle basename
Parameters:
  locale - the locale to use (but still uses NbBundle.getBranding default branding) the resource bundle
exception:
  MissingResourceException - if the bundle does not exist



getBundle
final public static ResourceBundle getBundle(String baseName, Locale locale, ClassLoader loader) throws MissingResourceException(Code)
Get a resource bundle the hard way.
Parameters:
  baseName - bundle basename
Parameters:
  locale - the locale to use (but still uses NbBundle.getBranding default branding)
Parameters:
  loader - the class loader to use the resource bundle
exception:
  MissingResourceException - if the bundle does not exist



getLocalizedFile
public static synchronized URL getLocalizedFile(String baseName, String ext) throws MissingResourceException(Code)
Get a localized and/or branded file in the default locale with the default class loader.

Note that use of this call is similar to using the URL protocol nbresloc (which may in fact be implemented using the fuller form of the method).

The extension may be null, in which case no final dot will be appended. If it is the empty string, the resource will end in a dot.
Parameters:
  baseName - base name of file, as dot-separated path (e.g. some.dir.File)
Parameters:
  ext - extension of file (or null) URL of matching localized file
throws:
  MissingResourceException - if not found




getLocalizedFile
public static synchronized URL getLocalizedFile(String baseName, String ext, Locale locale) throws MissingResourceException(Code)
Get a localized and/or branded file with the default class loader.
Parameters:
  baseName - base name of file, as dot-separated path (e.g. some.dir.File)
Parameters:
  ext - extension of file (or null)
Parameters:
  locale - locale of file URL of matching localized file
throws:
  MissingResourceException - if not found



getLocalizedFile
public static synchronized URL getLocalizedFile(String baseName, String ext, Locale locale, ClassLoader loader) throws MissingResourceException(Code)
Get a localized and/or branded file.
Parameters:
  baseName - base name of file, as dot-separated path (e.g. some.dir.File)
Parameters:
  ext - extension of file (or null)
Parameters:
  locale - locale of file
Parameters:
  loader - class loader to use URL of matching localized file
throws:
  MissingResourceException - if not found



getLocalizedValue
public static T getLocalizedValue(Map<String, T> table, String key, Locale locale)(Code)
Find a localized and/or branded value for a given key and locale. Scans through a map to find the most localized match possible. For example:

 findLocalizedValue (hashTable, "keyName", new Locale ("cs_CZ"))
 

This would return the first non-null value obtained from the following tests:

  • hashTable.get ("keyName_cs_CZ")
  • hashTable.get ("keyName_cs")
  • hashTable.get ("keyName")

Parameters:
  table - mapping from localized strings to objects
Parameters:
  key - the key to look for
Parameters:
  locale - the locale to use the localized object or null if no key matches



getLocalizedValue
public static T getLocalizedValue(Map<String, T> table, String key)(Code)
Find a localized and/or branded value for a given key in the default system locale.
Parameters:
  table - mapping from localized strings to objects
Parameters:
  key - the key to look for the localized object or null if no key matches
See Also:   NbBundle.getLocalizedValue(Map,String,Locale)



getLocalizedValue
public static String getLocalizedValue(Attributes attr, Attributes.Name key, Locale locale)(Code)
Find a localized and/or branded value in a JAR manifest.
Parameters:
  attr - the manifest attributes
Parameters:
  key - the key to look for (case-insensitive)
Parameters:
  locale - the locale to use the value if found, else null



getLocalizedValue
public static String getLocalizedValue(Attributes attr, Attributes.Name key)(Code)
Find a localized and/or branded value in a JAR manifest in the default system locale.
Parameters:
  attr - the manifest attributes
Parameters:
  key - the key to look for (case-insensitive) the value if found, else null



getLocalizingSuffixes
public static Iterator<String> getLocalizingSuffixes()(Code)
Get a list of all suffixes used to search for localized/branded resources. Based on the default locale and branding, returns the list of suffixes which various NbBundle methods use as the search order. For example, when NbBundle.getBranding returns branding and the default locale is German, you might get a sequence such as:
  1. "_branding_de"
  2. "_branding"
  3. "_de"
  4. ""
a read-only iterator of type String
since:
   1.1.5



getMessage
public static String getMessage(Class clazz, String resName) throws MissingResourceException(Code)
Finds a localized and/or branded string in a bundle.
Parameters:
  clazz - the class to use to locate the bundle
Parameters:
  resName - name of the resource to look for the string associated with the resource
throws:
  MissingResourceException - if either the bundle or the string cannot be found



getMessage
public static String getMessage(Class clazz, String resName, Object param1) throws MissingResourceException(Code)
Finds a localized and/or branded string in a bundle and formats the message by passing requested parameters.
Parameters:
  clazz - the class to use to locate the bundle
Parameters:
  resName - name of the resource to look for
Parameters:
  param1 - the argument to use when formatting the message the string associated with the resource
throws:
  MissingResourceException - if either the bundle or the string cannot be found
See Also:   java.text.MessageFormat.format(StringObject[])



getMessage
public static String getMessage(Class clazz, String resName, Object param1, Object param2) throws MissingResourceException(Code)
Finds a localized and/or branded string in a bundle and formats the message by passing requested parameters.
Parameters:
  clazz - the class to use to locate the bundle
Parameters:
  resName - name of the resource to look for
Parameters:
  param1 - the argument to use when formatting the message
Parameters:
  param2 - the second argument to use for formatting the string associated with the resource
throws:
  MissingResourceException - if either the bundle or the string cannot be found
See Also:   java.text.MessageFormat.format(StringObject[])



getMessage
public static String getMessage(Class clazz, String resName, Object param1, Object param2, Object param3) throws MissingResourceException(Code)
Finds a localized and/or branded string in a bundle and formats the message by passing requested parameters.
Parameters:
  clazz - the class to use to locate the bundle
Parameters:
  resName - name of the resource to look for
Parameters:
  param1 - the argument to use when formatting the message
Parameters:
  param2 - the second argument to use for formatting
Parameters:
  param3 - the third argument to use for formatting the string associated with the resource
throws:
  MissingResourceException - if either the bundle or the string cannot be found
See Also:   java.text.MessageFormat.format(StringObject[])



getMessage
public static String getMessage(Class clazz, String resName, Object[] arr) throws MissingResourceException(Code)
Finds a localized and/or branded string in a bundle and formats the message by passing requested parameters.
Parameters:
  clazz - the class to use to locate the bundle
Parameters:
  resName - name of the resource to look for
Parameters:
  arr - array of parameters to use for formatting the message the string associated with the resource
throws:
  MissingResourceException - if either the bundle or the string cannot be found
See Also:   java.text.MessageFormat.format(StringObject[])



setBranding
public static void setBranding(String bt) throws IllegalArgumentException(Code)
Set the current branding token. The permitted format, as a regular expression:
[a-z][a-z0-9]*(_[a-z][a-z0-9]*)*

This is normally only called by NetBeans startup code and unit tests. Currently the branding may be specified by passing the --branding command-line option to the launcher.


Parameters:
  bt - the new branding, or null to clear
throws:
  IllegalArgumentException - if in an incorrect format



setClassLoaderFinder
public static void setClassLoaderFinder(ClassLoaderFinder loaderFinder)(Code)
Do not use.
Parameters:
  loaderFinder - ignored



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.