Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2008 BEA Systems, Inc. All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.wlp.rest.results
Class ErrorResult

    java.lang.Object
      com.bea.wlp.rest.results.GenericRestResult
          com.bea.wlp.rest.results.ErrorResult

All Implemented Interfaces
  RestResult

    public class ErrorResult

extends GenericRestResult

Implementation of a basic error type `RestResult` that can be used to easily return a set of `ErrorCodes` which are defined in this class. This class has default versions of the error messages that are associated with each definited error code available by default, which can be overridden to a custom message by using the setMessage method. Optionally, the secondary constructor can be used to supply a custom integer status value and a custom error message.

Nested Class Summary

Nested classes/interfaces inherited from interface com.bea.wlp.rest.results.RestResult
`RestResult.FormatType`

Field Summary

Fields inherited from class com.bea.wlp.rest.results.GenericRestResult
`JSON_CONTENT_TYPE, XML_CONTENT_TYPE`

Constructor Summary
`ErrorResult(int status, String message)` Constructs an `ErrorResult` with the specified status number and the specified error message to be associated with that `ErrorCode`.
`ErrorResult(ResponseCode responseCode)` Constructs an `ErrorResult` with the specified `ResponseCode` and the default error message associated with that `ResponseCode`.

Method Summary
`String` | `getMessage()` Gets the error message for this `ErrorResult`
`Object` | `getResponseBean()` Gets this `RestResult` as a JavaBean `Object`.
`int` | `getStatus()` Gets the status number as a `String` for this `ErrorResult`
`boolean` | `isError()` Marks this ErrorResult type for handling as an HTTP error.
`void` | `setMessage(String message)` Sets a custom message for this `ErrorResult`

Methods inherited from class com.bea.wlp.rest.results.GenericRestResult
`getContentType, getResponse, setResponseBean, toJSON, toXML`

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

Constructor Detail

### ErrorResult

    public ErrorResult(ResponseCode responseCode)

  Constructs an `ErrorResult` with the specified `ResponseCode` and the default error message associated with that `ResponseCode`.

  Parameters
    `responseCode` - the `ResponseCode` for the `ErrorResult`

### ErrorResult

    public ErrorResult(int status,
                       String message)

  Constructs an `ErrorResult` with the specified status number and the specified error message to be associated with that `ErrorCode`.

  Parameters
    `status` - the status number for the `ErrorResult`
    `message` - the error message to associate to this `ErrorResult`

Method Detail

### setMessage

    public void setMessage(String message)

  Sets a custom message for this `ErrorResult`

  Parameters
    `message` - the error message text

### getStatus

    public int getStatus()

  Gets the status number as a `String` for this `ErrorResult`

  Specified by:
    `getStatus` in interface `RestResult`
  Overrides:
    `getStatus` in class `GenericRestResult`
  Returns
    the error status number

### isError

    public boolean isError()

  Marks this ErrorResult type for handling as an HTTP error.

  Specified by:
    `isError` in interface `RestResult`
  Overrides:
    `isError` in class `GenericRestResult`
  Returns
    true

### getMessage

    public String getMessage()

  Gets the error message for this `ErrorResult`

  Specified by:
    `getMessage` in interface `RestResult`
  Overrides:
    `getMessage` in class `GenericRestResult`
  Returns
    the error message description text

### getResponseBean

    public Object getResponseBean()

  Gets this `RestResult` as a JavaBean `Object`.

  Specified by:
    `getResponseBean` in interface `RestResult`
  Overrides:
    `getResponseBean` in class `GenericRestResult`
  Returns
    the `ResponseMessage` object that composes this result

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 BEA Systems, Inc. All Rights Reserved