com.sas.net.connect
Class RemoteObjectRB

com.sas.net.connect.RemoteObjectRB

public final class RemoteObjectRB

RemoteObjectRB loads and manages the resource bundle for the com.sas.net.connect package. RemoteObjectRB has convenience methods which allow other classes to fetch a string resource from the package resource bundle, which is created as a PropertyResourceBundle from com.sas.net.connect.RemoteObjectResources, which is defined in the properties file, RemoteObjectResources.properties (or in a locale-specific version such as RemoteObjectResources_de_DE.properties etc.)


Constructor Summary
RemoteObjectRB()
          Construct an instance of a RemoteObjectRB which accesses the resources in the resource bundle com.sas.net.connect.RemoteObjectResources.
 
Method Summary
static java.util.ResourceBundle getResources()
          Get the default resource bundle for this package, which is created as a PropertyResourceBundle from com.sas.net.connect.RemoteObjectResources, which is defined in the properties file, <package-path>/RemoteObjectResources.properties (or in a locale-specific version such as RemoteObjectResources_de_DE.properties etc.)
static java.lang.String getStringResource(java.lang.String key)
          Return a string resource from the default resource bundle.
static java.lang.String getStringResource(java.lang.String key, java.util.Locale locale)
          Return a string resource from the default resource bundle and locale.
static java.lang.String getStringResource(java.lang.String classKey, java.lang.String subKey)
          Return a string resource from the default resource bundle via getStringResource(classKey + subKey).
static java.lang.String getStringResource(java.lang.String classKey, java.lang.String subKey, java.util.Locale locale)
          Return a string resource from the default resource bundle via getStringResource(classKey + subKey) and a specific Locale.
 

Constructor Detail

RemoteObjectRB

public RemoteObjectRB()
Construct an instance of a RemoteObjectRB which accesses the resources in the resource bundle com.sas.net.connect.RemoteObjectResources. Normally, you won't use this constructor. Instead, use the static methods such as getStringResource(String key) to get resources.

Method Detail

getStringResource

public static java.lang.String getStringResource(java.lang.String classKey,
                                                 java.lang.String subKey)
Return a string resource from the default resource bundle via getStringResource(classKey + subKey). Consider using getStringResource(String) instead of this method, since this method requires runtime String concatenation and transient object allocation. If the classKey and subKey are static finals or literals, the Java compiler will perform the concatenation for a call such as RemoteObjectRB.getStringResource(classKey + subKey) at compile time.

If possible, you should use getStringResource(String key) in cases where the classKey and subKey are string constants, so the compiler can do compile time string concatenation, rather than forcing this method to concatenate.

Parameters:
classKey - a prefix for a resource key, often the class base name with a trailing ".". For example, the com.sas.util.Alarm class will use the class key "Alarm."
subKey - a resource key. The classKey and subKey are concatenated (classKey + subkey) to yield a key and then a resource is fetched from the resource bundle.
Returns:
String a string resource obtained via the key.
Throws:
java.util.MissingResourceException - if there is no resource for the string (classKey + subKey)

getStringResource

public static java.lang.String getStringResource(java.lang.String classKey,
                                                 java.lang.String subKey,
                                                 java.util.Locale locale)
Return a string resource from the default resource bundle via getStringResource(classKey + subKey) and a specific Locale. Consider using getStringResource(String, Locale) instead of this method, since this method requires runtime String concatenation and transient object allocation. If the classKey and subKey are static finals or literals, the Java compiler will perform the concatenation for a call such as RemoteObjectRB.getStringResource(classKey + subKey, locale) at compile time.

If possible, you should use getStringResource(String key, Locale locale) in cases where the classKey and subKey are string constants, so the compiler can do compile time string concatenation, rather than forcing this method to concatenate.

Parameters:
classKey - a prefix for a resource key, often the class base name with a trailing ".". For example, the com.sas.util.Alarm class will use the class key "Alarm."
subKey - a resource key. The classKey and subKey are concatenated (classKey + subkey) to yield a key and then a resource is fetched from the resource bundle.
locale - a locale to use when loading resources. If null, use the Locale.getDefault()
Returns:
String a string resource obtained via the key.
Throws:
java.util.MissingResourceException - if there is no resource for the string (classKey + subKey)

getStringResource

public static java.lang.String getStringResource(java.lang.String key)
Return a string resource from the default resource bundle.

Parameters:
key - a resource key
Returns:
String a string resource obtained from the key, namely getResources().getString(key)
Throws:
java.util.MissingResourceException - if there is no resource for the key.

getStringResource

public static java.lang.String getStringResource(java.lang.String key,
                                                 java.util.Locale locale)
Return a string resource from the default resource bundle and locale.

Parameters:
key - a resource key
locale - a locale to use when loading resources. If null, use the Locale.getDefault()
Returns:
String a string resource obtained from the key, namely getResources().getString(key)
Throws:
java.util.MissingResourceException - if there is no resource for the key.

getResources

public static java.util.ResourceBundle getResources()
Get the default resource bundle for this package, which is created as a PropertyResourceBundle from com.sas.net.connect.RemoteObjectResources, which is defined in the properties file, <package-path>/RemoteObjectResources.properties (or in a locale-specific version such as RemoteObjectResources_de_DE.properties etc.)

Returns:
the default resource bundle.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.