Package scriptella.spi.support
Class HierarchicalParametersCallback
java.lang.Object
scriptella.spi.support.HierarchicalParametersCallback
- All Implemented Interfaces:
ParametersCallback
Hierarchical implementation of
ParametersCallback interface.
This class decorates behaviour of a primary callback by obtaining absent parameter values from the parent callback.
Note: This class is mutable and not thread-safe.
- Version:
- 1.0
- Author:
- Fyodor Kupolov
-
Constructor Summary
ConstructorsConstructorDescriptionHierarchicalParametersCallback(ParametersCallback callback, ParametersCallback parentCallback) Creates a hierarchical parameters callback instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns primary callback.getParameter(String name) This method obtains the value of a specified parameter from the primary callback .Returns secondary callback.voidsetCallback(ParametersCallback callback) Sets primary callback.voidsetParentCallback(ParametersCallback parentCallback) Sets secondary callback.
-
Constructor Details
-
HierarchicalParametersCallback
public HierarchicalParametersCallback(ParametersCallback callback, ParametersCallback parentCallback) Creates a hierarchical parameters callback instance.- Parameters:
callback- primary callback.parentCallback- secondary (parent) callback. If null - only primary callback is used.
-
-
Method Details
-
getCallback
Returns primary callback.- Returns:
- primary callback.
-
setCallback
Sets primary callback.- Parameters:
callback- primary callback. Cannot be null.
-
getParentCallback
Returns secondary callback.- Returns:
- secondary callback.
-
setParentCallback
Sets secondary callback.- Parameters:
parentCallback- secondary callback. May be null, in this case only primary callback is used.
-
getParameter
This method obtains the value of a specified parameter from the primary callback . If the returned value is null, the parameter's value is obtained from secondary callback.- Specified by:
getParameterin interfaceParametersCallback- Parameters:
name- parameter name.- Returns:
- value of the specified parameter.
-