public class ConfigurationErrorEvent extends Event
An event class that is used for reporting errors that occurred while processing configuration properties.
Some configuration implementations (e.g.
DatabaseConfiguration
or
JNDIConfiguration
use an underlying
storage that can throw an exception on each property access. In earlier
versions of this library such exceptions were logged and then silently
ignored. This makes it impossible for a client to find out that something
went wrong.
To give clients better control over the handling of errors that might occur while interacting with a configuration object, a specialized error event type is introduced. Clients can register as listeners of this event type at a configuration object and are then notified about all internal errors related to the source configuration object.
This class defines similar properties to the ConfigurationEvent
class. This makes it possible to find out which operation was performed on a
configuration causing this error event. In addition, a Throwable
object is available representing the occurred error. Note that depending on
the event type and the occurred exception not all of the other properties
(e.g. name of the affected property or its value) may be available.
ConfigurationEvent
,
Serialized FormModifier and Type | Field and Description |
---|---|
static EventType<ConfigurationErrorEvent> |
ANY
Constant for the common event type for all error events.
|
static EventType<ConfigurationErrorEvent> |
READ
Constant for the event type indicating a read error.
|
static EventType<ConfigurationErrorEvent> |
WRITE
Constant for the event type indicating a write error.
|
source
Constructor and Description |
---|
ConfigurationErrorEvent(Object source,
EventType<? extends ConfigurationErrorEvent> eventType,
EventType<?> operationType,
String propName,
Object propValue,
Throwable cause)
Creates a new instance of
ConfigurationErrorEvent and sets all
its properties. |
Modifier and Type | Method and Description |
---|---|
Throwable |
getCause()
Returns the cause of this error event.
|
EventType<?> |
getErrorOperationType()
Returns the
EventType of the operation which caused this error. |
String |
getPropertyName()
Returns the name of the property that was accessed when this error
occurred.
|
Object |
getPropertyValue()
Returns the value of the property that was accessed when this error
occurred.
|
appendPropertyRepresentation, getEventType, toString
getSource
public static final EventType<ConfigurationErrorEvent> ANY
public static final EventType<ConfigurationErrorEvent> READ
public static final EventType<ConfigurationErrorEvent> WRITE
public ConfigurationErrorEvent(Object source, EventType<? extends ConfigurationErrorEvent> eventType, EventType<?> operationType, String propName, Object propValue, Throwable cause)
ConfigurationErrorEvent
and sets all
its properties.source
- the event sourceeventType
- the type of this eventoperationType
- the event type of the operation causing this errorpropName
- the name of the affected propertypropValue
- the value of the affected propertycause
- the exception object that caused this eventpublic EventType<?> getErrorOperationType()
EventType
of the operation which caused this error.public String getPropertyName()
public Object getPropertyValue()
public Throwable getCause()
Throwable
object that caused this event to be fired.Copyright © 2001–2020 The Apache Software Foundation. All rights reserved.