org.apache.commons.configuration
Class ConfigurationFactory.CallOptionalMethodRule

java.lang.Object
  extended by org.apache.commons.digester.Rule
      extended by org.apache.commons.digester.CallMethodRule
          extended by org.apache.commons.configuration.ConfigurationFactory.CallOptionalMethodRule
Enclosing class:
ConfigurationFactory

private static class ConfigurationFactory.CallOptionalMethodRule
extends org.apache.commons.digester.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
private  boolean optional
          A flag whether the optional attribute is set for this node.
 
Fields inherited from class org.apache.commons.digester.CallMethodRule
bodyText, methodName, paramCount, paramTypes, targetOffset, useExactMatch
 
Fields inherited from class org.apache.commons.digester.Rule
digester, namespaceURI
 
Constructor Summary
ConfigurationFactory.CallOptionalMethodRule(java.lang.String methodName)
          Creates a new instance of CallOptionalMethodRule and sets the name of the method to invoke.
 
Method Summary
 void begin(org.xml.sax.Attributes attrs)
          Checks if the optional attribute is set.
 void end()
          Calls the method.
 
Methods inherited from class org.apache.commons.digester.CallMethodRule
body, finish, getUseExactMatch, processMethodCallResult, setDigester, setUseExactMatch, toString
 
Methods inherited from class org.apache.commons.digester.Rule
begin, body, end, getDigester, getNamespaceURI, setNamespaceURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

optional

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

Constructor Detail

ConfigurationFactory.CallOptionalMethodRule

public ConfigurationFactory.CallOptionalMethodRule(java.lang.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(org.xml.sax.Attributes attrs)
           throws java.lang.Exception
Checks if the optional attribute is set.

Overrides:
begin in class org.apache.commons.digester.CallMethodRule
Parameters:
attrs - the attributes
Throws:
java.lang.Exception - if an error occurs

end

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

Overrides:
end in class org.apache.commons.digester.CallMethodRule
Throws:
java.lang.Exception - if an error occurs