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.EventSourceSupportThe level ofEventSourcesupport. -
Constructor Summary
ConstructorsConstructorDescriptionBuilderConfigurationWrapperInvocationHandler(ConfigurationBuilder<? extends ImmutableConfiguration> wrappedBuilder, BuilderConfigurationWrapperFactory.EventSourceSupport evSrcSupport) Creates a new instance ofBuilderConfigurationWrapperInvocationHandler. -
Method Summary
Modifier and TypeMethodDescriptionprivate ObjecthandleConfigurationInvocation(Method method, Object[] args) Handles a method invocation on the associated builder's configuration object.private ObjecthandleEventSourceInvocation(Method method, Object... args) Handles a method invocation on theEventSourceinterface.Handles method invocations.
-
Field Details
-
builder
The wrapped builder. -
eventSourceSupport
The level ofEventSourcesupport.
-
-
Constructor Details
-
BuilderConfigurationWrapperInvocationHandler
public BuilderConfigurationWrapperInvocationHandler(ConfigurationBuilder<? extends ImmutableConfiguration> wrappedBuilder, BuilderConfigurationWrapperFactory.EventSourceSupport evSrcSupport) Creates a new instance ofBuilderConfigurationWrapperInvocationHandler.- Parameters:
wrappedBuilder- the wrapped builderevSrcSupport- the level ofEventSourcesupport
-
-
Method Details
-
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 occursReflectiveOperationExceptionConfigurationException
-
handleEventSourceInvocation
private Object handleEventSourceInvocation(Method method, Object... args) throws ReflectiveOperationException Handles a method invocation on theEventSourceinterface. This method evaluates the currentEventSourceSupportobject 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
-
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
EventSourceinterface are handled according to the current support level. - Other method calls are delegated to the builder's configuration object.
- Specified by:
invokein 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
-