Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Business Components
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.jbo.common
Class JboExHelperLocalized

    java.lang.Object
      |
      +--oracle.jbo.common.JboExceptionHelper
            |
            +--oracle.jbo.common.JboExHelperLocalized

public class JboExHelperLocalized
extends JboExceptionHelper

The superclass for localized exceptions for Business Components.

This class provides tools for localizing exception messages for various target languages, and for message formatting.

Message-text localization occurs when the client calls `getLocalizedMessage()`, rather than at time the exception occurs, because the client may need to present the message in a number of different languages.

The components of a message are:

- a non-translated product code string, such as `"FRM"` or `"ORA"`.
- a non-translated error code string, such as `"10234"`
- non-translated message text.
- message parameters, equal in number to the number of '%' symbols in the message text.
- a "details" list containing background information.

Additional components may be introduced in future.

A counterpart subclass of `ResourceBundle`, `JboExceptionBundle`, is used to determine the overall formatting of the message. The default format is

> productCode-errorCode: messageBody

For example, `ORA-10234: I don't think so.`

Most subclasses wll provide a value for the error code in a specialized constructor.

Applications may define subclasses of most JBO exceptions. To do this the application should override the following methods to provide the correct set of values for the messaging services:

- `getResourceName`
to return the name of the appropriate resource bundle.
- `getProductCode`
to return the name of the product.

Other methods may be overridden to modify the message format.

Since:
  JDeveloper 3.0
See Also:
  `JboExceptionHelper`

Field Summary
`protected java.lang.Class` | `mResBundleClass`

Constructor Summary
`JboExHelperLocalized(JboMessage ex, java.lang.Class resBundleClass, java.lang.String errorCode, java.lang.Object[] params)` Creates a translatable exception.

Method Summary
`java.lang.String` | `getBaseMessage()` Gets the message without localizing it or inserting parameters.
`protected java.lang.String` | `getErrorMsg(java.util.Locale l, java.lang.Object[] params)`
`java.lang.String` | `getLocalizedBaseMessage(java.util.Locale l)` Localizes an un-parameterized message text for a specific `Locale`.
`java.lang.String` | `getLocalizedMessage(java.util.Locale l)` Formats the message text for a specific `Locale`.
`java.lang.Class` | `getResourceClass()` Gets the resource bundle used to localize messages.
`java.lang.String` | `getResourceName()` Gets the name of the `ResourceBundle` used to localize messages.

Methods inherited from class oracle.jbo.common.JboExceptionHelper
`addToDetails, getDetailMessage, getDetails, getErrorCode, getErrorMsgFormat, getErrorParameters, getMessage, getProductCode, setDetails, setErrorParameters`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### mResBundleClass

    protected java.lang.Class mResBundleClass

Constructor Detail

### JboExHelperLocalized

    public JboExHelperLocalized(JboMessage ex,
                                java.lang.Class resBundleClass,
                                java.lang.String errorCode,
                                java.lang.Object[] params)

  Creates a translatable exception.
  Parameters:
    `ex` - a Business Component error or warning.
    `resBundleClass` - a collection of message template, accessed by key.
    `errorCode` - error code; a key associated with a message template in `resBundleClass`.
    `params` - the error message's parameters.

Method Detail

### getLocalizedMessage

    public java.lang.String getLocalizedMessage(java.util.Locale l)

  Formats the message text for a specific `Locale`.
  Overrides:
    getLocalizedMessage in class JboExceptionHelper
  Parameters:
    `l` - a locale.
  Returns:
    the localized message.

### getBaseMessage

    public java.lang.String getBaseMessage()

  Gets the message without localizing it or inserting parameters.
  Overrides:
    getBaseMessage in class JboExceptionHelper
  Returns:
    the un-formatted, non-localized message.

### getLocalizedBaseMessage

    public java.lang.String getLocalizedBaseMessage(java.util.Locale l)

  Localizes an un-parameterized message text for a specific `Locale`.
  Overrides:
    getLocalizedBaseMessage in class JboExceptionHelper
  Parameters:
    `l` - a locale.
  Returns:
    the localalized but un-formatted message.

### getResourceName

    public java.lang.String getResourceName()

  Gets the name of the `ResourceBundle` used to localize messages.
  Overrides:
    getResourceName in class JboExceptionHelper
  Returns:
    the name of this class' `ResourceBundle`.

### getResourceClass

    public java.lang.Class getResourceClass()

  Gets the resource bundle used to localize messages.
  Overrides:
    getResourceClass in class JboExceptionHelper
  Returns:
    this class' `ResourceBundle`.

### getErrorMsg

    protected java.lang.String getErrorMsg(java.util.Locale l,
                                           java.lang.Object[] params)

  Overrides:
    getErrorMsg in class JboExceptionHelper

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Business Components
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD