1 15 package org.apache.tapestry.util.io; 16 17 import org.apache.tapestry.services.DataSqueezer; 18 19 24 25 class BooleanAdaptor implements ISqueezeAdaptor 26 { 27 private static final String PREFIX = "TF"; 28 29 32 33 public void register(DataSqueezer squeezer) 34 { 35 squeezer.register(PREFIX, Boolean .class, this); 36 } 37 38 41 42 public String squeeze(DataSqueezer squeezer, Object data) 43 { 44 Boolean bool = (Boolean ) data; 45 46 return bool.booleanValue() ? "T" : "F"; 47 } 48 49 53 54 public Object unsqueeze(DataSqueezer squeezer, String string) 55 { 56 char ch = string.charAt(0); 57 58 if (ch == 'T') 59 return Boolean.TRUE; 60 61 return Boolean.FALSE; 62 } 63 64 } | Popular Tags |