KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > datatypes > processors > CharTransformerProcessor


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.datatypes.processors;
11
12 import org.mmbase.bridge.*;
13 import org.mmbase.util.transformers.CharTransformer;
14
15 /**
16  * A processor based on a chartransformer (works only for Strings). This gives easy access to all kind of
17  * string transformations.
18  *
19  * @author Michiel Meeuwissen
20  * @version $Id: CharTransformerProcessor.java,v 1.2 2005/12/10 14:33:36 michiel Exp $
21  * @since MMBase-1.7
22  * @see org.mmbase.util.transformers.CharTransformer
23  */

24
25 public class CharTransformerProcessor implements Processor {
26     private static final long serialVersionUID = 1L;
27
28     private CharTransformer charTransformer;
29
30     public CharTransformerProcessor(CharTransformer ct) {
31         charTransformer = ct;
32     }
33
34     public final Object JavaDoc process(Node node, Field field, Object JavaDoc value) {
35         if (value == null) return null; // most CharTransformers would not choke in that, but lets not risque it.
36
return charTransformer.transform((String JavaDoc) value);
37     }
38
39     public String JavaDoc toString() {
40         return "processor(" + charTransformer + ")";
41     }
42 }
43
Popular Tags