KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > containers > ComponentTransformer


1 /*****************************************************************************
2  * Copyright (C) Codehaus.org. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 /*
9  * Created on Mar 8, 2005
10  *
11  * Author Ben Yu
12  * ZBS
13  */

14 package jfun.yan.containers;
15
16 import jfun.yan.Component;
17
18 /**
19  * This class represents a combinator to transform Component objects.
20  * <p>
21  * Codehaus.org.
22  *
23  * @author Ben Yu
24  *
25  */

26 public abstract class ComponentTransformer
27 implements java.io.Serializable JavaDoc{
28   /**
29    * Transforms one Component object to another.
30    * @param cc the Component object to transform.
31    * @return the transformed Component object.
32    */

33   public abstract Component transform(Component cc);
34   /**
35    * Transforms one Component object to another.
36    * By default, this delegates to transform(cc);
37    * @param key the component key.
38    * @param cc the component.
39    * @return the transformed Component object.
40    */

41   public Component transform(Object JavaDoc key, Component cc){
42     return transform(cc);
43   }
44   /**
45    * Create a new ComponentTransformer by sequencing
46    * this transformer and another transformer.
47    * i.e., t1.seq(t2).transform(cc) is equivalent to
48    * t2.transform(t1.transform(cc)).
49    * @param ct the ComponentTransformer object to sequence with.
50    * @return the new ComponentTransformer object.
51    */

52   public final ComponentTransformer seq(ComponentTransformer ct){
53     return ComponentTransformers.seq(this, ct);
54   }
55 }
56
Popular Tags