org.apache.cocoon.selection
Class ParameterSelector

java.lang.Object
  extended by org.apache.cocoon.selection.ParameterSelector
All Implemented Interfaces:
Component, ThreadSafe, Selector

public class ParameterSelector
extends Object
implements ThreadSafe, Selector

A Selector that matches a string in the parameters object passed to it.

  <map:selector name="parameter" factory="org.apache.cocoon.selection.ParameterSelector"/>

   <map:select type="parameter">
      <map:parameter name="parameter-selector-test" value="{mySitemapParameter}"/>

      <map:when test="myParameterValue">
         <!-- executes iff {mySitemapParameter} == "myParameterValue" -->
         <map:transform src="stylesheets/page/uk.xsl"/>
      </map:when>
      <map:otherwise>
         <map:transform src="stylesheets/page/us.xsl"/>
      </map:otherwise>
   </map:select>
 
The purpose of this selector is to allow an action to set parameters and to be able to select between different pipeline configurations depending on those parameters.

Version:
CVS $Id: ParameterSelector.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Leo Sutic, Sylvain Wallez

Field Summary
 
Fields inherited from interface org.apache.cocoon.selection.Selector
ROLE
 
Constructor Summary
ParameterSelector()
           
 
Method Summary
 boolean select(String expression, Map objectModel, Parameters parameters)
          Selectors test pattern against some objects in a Map model and signals success with the returned boolean value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParameterSelector

public ParameterSelector()
Method Detail

select

public boolean select(String expression,
                      Map objectModel,
                      Parameters parameters)
Description copied from interface: Selector
Selectors test pattern against some objects in a Map model and signals success with the returned boolean value

Specified by:
select in interface Selector
Parameters:
expression - The expression to test.
objectModel - The Map containing object of the calling environment which may be used to select values to test the expression.
parameters - The sitemap parameters, as specified by <parameter/> tags.
Returns:
boolean Signals successfull test.


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.