Class BuilderConfigurationWrapperFactory.BuilderConfigurationWrapperInvocationHandler
- java.lang.Object
-
- org.apache.commons.configuration2.builder.BuilderConfigurationWrapperFactory.BuilderConfigurationWrapperInvocationHandler
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
- Enclosing class:
- BuilderConfigurationWrapperFactory
private static final class BuilderConfigurationWrapperFactory.BuilderConfigurationWrapperInvocationHandler extends java.lang.Object implements java.lang.reflect.InvocationHandler
A specializedInvocationHandler
implementation for wrapper configurations. Here the logic of accessing a wrapped builder is implemented.
-
-
Field Summary
Fields Modifier and Type Field Description private ConfigurationBuilder<? extends ImmutableConfiguration>
builder
The wrapped builder.private BuilderConfigurationWrapperFactory.EventSourceSupport
eventSourceSupport
The level ofEventSource
support.
-
Constructor Summary
Constructors Constructor Description BuilderConfigurationWrapperInvocationHandler(ConfigurationBuilder<? extends ImmutableConfiguration> wrappedBuilder, BuilderConfigurationWrapperFactory.EventSourceSupport evSrcSupport)
Creates a new instance ofBuilderConfigurationWrapperInvocationHandler
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.Object
handleConfigurationInvocation(java.lang.reflect.Method method, java.lang.Object[] args)
Handles a method invocation on the associated builder's configuration object.private java.lang.Object
handleEventSourceInvocation(java.lang.reflect.Method method, java.lang.Object... args)
Handles a method invocation on theEventSource
interface.java.lang.Object
invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
Handles method invocations.
-
-
-
Field Detail
-
builder
private final ConfigurationBuilder<? extends ImmutableConfiguration> builder
The wrapped builder.
-
eventSourceSupport
private final BuilderConfigurationWrapperFactory.EventSourceSupport eventSourceSupport
The level ofEventSource
support.
-
-
Constructor Detail
-
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 Detail
-
handleConfigurationInvocation
private java.lang.Object handleConfigurationInvocation(java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.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:
java.lang.Exception
- if an error occursjava.lang.ReflectiveOperationException
ConfigurationException
-
handleEventSourceInvocation
private java.lang.Object handleEventSourceInvocation(java.lang.reflect.Method method, java.lang.Object... args) throws java.lang.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:
java.lang.ReflectiveOperationException
- if an error occurs
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.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 interfacejava.lang.reflect.InvocationHandler
- Parameters:
proxy
- the proxy objectmethod
- the method to be invokedargs
- method arguments- Returns:
- the return value of the method
- Throws:
java.lang.ReflectiveOperationException
- if an error occursConfigurationException
- if an error occurs
- Methods from the
-
-