scriptella.spi.support
Class HierarchicalParametersCallback

java.lang.Object
  extended by scriptella.spi.support.HierarchicalParametersCallback
All Implemented Interfaces:
ParametersCallback

public class HierarchicalParametersCallback
extends java.lang.Object
implements 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
HierarchicalParametersCallback(ParametersCallback callback, ParametersCallback parentCallback)
          Creates a hierarchical parameters callback instance.
 
Method Summary
 ParametersCallback getCallback()
          Returns primary callback.
 java.lang.Object getParameter(java.lang.String name)
          This method obtains the value of a specified parameter from the primary callback .
 ParametersCallback getParentCallback()
          Returns secondary callback.
 void setCallback(ParametersCallback callback)
          Sets primary callback.
 void setParentCallback(ParametersCallback parentCallback)
          Sets secondary callback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

getCallback

public ParametersCallback getCallback()
Returns primary callback.

Returns:
primary callback.

setCallback

public void setCallback(ParametersCallback callback)
Sets primary callback.

Parameters:
callback - primary callback. Cannot be null.

getParentCallback

public ParametersCallback getParentCallback()
Returns secondary callback.

Returns:
secondary callback.

setParentCallback

public void setParentCallback(ParametersCallback parentCallback)
Sets secondary callback.

Parameters:
parentCallback - secondary callback. May be null, in this case only primary callback is used.

getParameter

public java.lang.Object getParameter(java.lang.String name)
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:
getParameter in interface ParametersCallback
Parameters:
name - parameter name.
Returns:
value of the specified parameter.


Copyright © Copyright 2006-2009 The Scriptella Project Team.