Class BuilderConfigurationWrapperFactory.BuilderConfigurationWrapperInvocationHandler
java.lang.Object
org.apache.commons.configuration2.builder.BuilderConfigurationWrapperFactory.BuilderConfigurationWrapperInvocationHandler
- All Implemented Interfaces:
InvocationHandler
- Enclosing class:
BuilderConfigurationWrapperFactory
private static final class BuilderConfigurationWrapperFactory.BuilderConfigurationWrapperInvocationHandler
extends Object
implements InvocationHandler
A specialized
InvocationHandler
implementation for wrapper configurations. Here the logic of accessing a
wrapped builder is implemented.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConfigurationBuilder
<? extends ImmutableConfiguration> The wrapped builder.private final BuilderConfigurationWrapperFactory.EventSourceSupport
The level ofEventSource
support. -
Constructor Summary
ConstructorsConstructorDescriptionBuilderConfigurationWrapperInvocationHandler
(ConfigurationBuilder<? extends ImmutableConfiguration> wrappedBuilder, BuilderConfigurationWrapperFactory.EventSourceSupport evSrcSupport) Creates a new instance ofBuilderConfigurationWrapperInvocationHandler
. -
Method Summary
Modifier and TypeMethodDescriptionprivate Object
handleConfigurationInvocation
(Method method, Object[] args) Handles a method invocation on the associated builder's configuration object.private Object
handleEventSourceInvocation
(Method method, Object... args) Handles a method invocation on theEventSource
interface.Handles method invocations.
-
Field Details
-
builder
The wrapped builder. -
eventSourceSupport
The level ofEventSource
support.
-
-
Constructor Details
-
BuilderConfigurationWrapperInvocationHandler
public BuilderConfigurationWrapperInvocationHandler(ConfigurationBuilder<? extends ImmutableConfiguration> wrappedBuilder, BuilderConfigurationWrapperFactory.EventSourceSupport evSrcSupport) Creates a new instance ofBuilderConfigurationWrapperInvocationHandler
.- Parameters:
wrappedBuilder
- the wrapped builderevSrcSupport
- the level ofEventSource
support
-
-
Method Details
-
invoke
public Object invoke(Object proxy, Method method, Object[] args) throws ReflectiveOperationException, ConfigurationException Handles method invocations. This implementation handles methods of two different interfaces:- Methods from the
EventSource
interface are handled according to the current support level. - Other method calls are delegated to the builder's configuration object.
- Specified by:
invoke
in interfaceInvocationHandler
- Parameters:
proxy
- the proxy objectmethod
- the method to be invokedargs
- method arguments- Returns:
- the return value of the method
- Throws:
ReflectiveOperationException
- if an error occursConfigurationException
- if an error occurs
- Methods from the
-
handleConfigurationInvocation
private Object handleConfigurationInvocation(Method method, Object[] args) throws ReflectiveOperationException, ConfigurationException Handles a method invocation on the associated builder's configuration object.- Parameters:
method
- the method to be invokedargs
- method arguments- Returns:
- the return value of the method
- Throws:
Exception
- if an error occursReflectiveOperationException
ConfigurationException
-
handleEventSourceInvocation
private Object handleEventSourceInvocation(Method method, Object... args) throws ReflectiveOperationException Handles a method invocation on theEventSource
interface. This method evaluates the currentEventSourceSupport
object in order to find the appropriate target for the invocation.- Parameters:
method
- the method to be invokedargs
- method arguments- Returns:
- the return value of the method
- Throws:
ReflectiveOperationException
- if an error occurs
-