org.apache.commons.configuration

Class ConfigurationFactory.CallOptionalMethodRule

private static class ConfigurationFactory.CallOptionalMethodRule extends CallMethodRule

A special implementation of Digester's CallMethodRule that is internally used for calling a file configuration's load() method. This class difers from its ancestor that it catches all occuring exceptions when the specified method is called. It then checks whether for the corresponding configuration the optional attribute is set. If this is the case, the exception will simply be ignored.

Since: 1.4

Field Summary
booleanoptional
A flag whether the optional attribute is set for this node.
Constructor Summary
CallOptionalMethodRule(String methodName)
Creates a new instance of CallOptionalMethodRule and sets the name of the method to invoke.
Method Summary
voidbegin(Attributes attrs)
Checks if the optional attribute is set.
voidend()
Calls the method.

Field Detail

optional

private boolean optional
A flag whether the optional attribute is set for this node.

Constructor Detail

CallOptionalMethodRule

public CallOptionalMethodRule(String methodName)
Creates a new instance of CallOptionalMethodRule and sets the name of the method to invoke.

Parameters: methodName the name of the method

Method Detail

begin

public void begin(Attributes attrs)
Checks if the optional attribute is set.

Parameters: attrs the attributes

Throws: Exception if an error occurs

end

public void end()
Calls the method. If the optional attribute was set, occurring exceptions will be ignored.

Throws: Exception if an error occurs