KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > context > exe > converter > BooleanToStringConverter


1 package org.jbpm.context.exe.converter;
2
3 import org.jbpm.context.exe.*;
4
5 public class BooleanToStringConverter implements Converter {
6   
7   private static final long serialVersionUID = 1L;
8   
9   public static final String JavaDoc TRUE_TEXT = "T";
10   public static final String JavaDoc FALSE_TEXT = "F";
11
12   public boolean supports(Class JavaDoc clazz) {
13     return (clazz==Boolean JavaDoc.class);
14   }
15
16   public Object JavaDoc convert(Object JavaDoc o) {
17     String JavaDoc convertedValue = FALSE_TEXT;
18     if (((Boolean JavaDoc)o).booleanValue()) {
19       convertedValue = TRUE_TEXT;
20     }
21     return convertedValue;
22   }
23
24   public Object JavaDoc revert(Object JavaDoc o) {
25     Boolean JavaDoc revertedValue = Boolean.FALSE;
26     if (TRUE_TEXT.equals(o)) {
27       revertedValue = Boolean.TRUE;
28     }
29     return revertedValue;
30   }
31 }
32
Popular Tags