KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infohazard > maverick > flow > TransformWithParams


1 /*
2  * $Id: TransformWithParams.java,v 1.2 2003/02/19 22:50:49 lhoriman Exp $
3  * $Source: /cvsroot/mav/maverick/src/java/org/infohazard/maverick/flow/TransformWithParams.java,v $
4  */

5
6 package org.infohazard.maverick.flow;
7
8 import java.util.Map JavaDoc;
9 import javax.servlet.ServletException JavaDoc;
10
11 /**
12  * This is a Decorator pattern, adding params defined for a transform.
13  */

14 class TransformWithParams implements Transform
15 {
16     /**
17      */

18     protected Transform decorated;
19     protected Map JavaDoc params;
20     
21     /**
22      */

23     public TransformWithParams(Transform simpler, Map JavaDoc params)
24     {
25         if (params == null)
26             throw new IllegalArgumentException JavaDoc("Don't use this decorator without params");
27             
28         this.decorated = simpler;
29         this.params = params;
30     }
31      
32     /**
33      * Sets some params before creating the step
34      */

35     public TransformStep createStep(TransformContext tctx) throws ServletException JavaDoc
36     {
37         // Get access to the internal API.
38
((MaverickContext)tctx).putAllTransformParams(this.params);
39         
40         return this.decorated.createStep(tctx);
41     }
42 }
43
Popular Tags