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

## org.apache.commons.lang3.exception
Interface ExceptionContext

All Known Implementing Classes:
  ContextedException, ContextedRuntimeException

    public interface ExceptionContext

Allows the storage and retrieval of contextual information based on label-value pairs for exceptions.

Since:
  3.0
Author:
  Apache Software Foundation, D. Ashmore
See Also:
  `ContextedException`, `ContextedRuntimeException`

Method Summary
`ExceptionContext` | `addValue(String label, Object value)` Adds a contextual label-value pair into this context.
`String` | `getFormattedExceptionMessage(String baseMessage)` Implementors provide the given base message with context label/value item information appended.
`Set<String>` | `getLabelSet()` Retrieves the labels defined in the contextual data.
`Object` | `getValue(String label)` Retrieves a contextual data value associated with the label.
`ExceptionContext` | `replaceValue(String label, Object value)` Replaces a contextual label-value pair of this context.

Method Detail

### addValue

    ExceptionContext addValue(String label,
                              Object value)

  Adds a contextual label-value pair into this context.

  This label-value pair provides information useful for debugging. If the provided label already exists, it depends on the implementation what happens with the new value.

  Parameters:
    `label` - the label of the item to add, null not recommended
    `value` - the value of item to add, may be null
  Returns:
    context itself to allow method chaining

### replaceValue

    ExceptionContext replaceValue(String label,
                                  Object value)

  Replaces a contextual label-value pair of this context.

  This label-value pair provides information useful for debugging. If the label does not exist yet, it depends on the implementation what happens with the provided value.

  Parameters:
    `label` - the label of the item to add, null not recommended
    `value` - the value of item to add, may be null
  Returns:
    context itself to allow method chaining

### getValue

    Object getValue(String label)

  Retrieves a contextual data value associated with the label.

  Parameters:
    `label` - the label to get the contextual value for, may be null
  Returns:
    the contextual value associated with the label, may be null

### getLabelSet

    Set<String> getLabelSet()

  Retrieves the labels defined in the contextual data.

  Returns:
    the set of labels, never null

### getFormattedExceptionMessage

    String getFormattedExceptionMessage(String baseMessage)

  Implementors provide the given base message with context label/value item information appended.

  Parameters:
    `baseMessage` - the base exception message without context information appended
  Returns:
    the exception message with context information appended, never null

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

Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.