1 package org.hibernate.sql; 3 4 import java.util.Iterator ; 5 import java.util.Map ; 6 7 14 public class MckoiCaseFragment extends CaseFragment { 15 16 public String toFragmentString() { 17 StringBuffer buf = new StringBuffer ( cases.size() * 15 + 10 ); 18 StringBuffer buf2= new StringBuffer ( cases.size() ); 19 20 Iterator iter = cases.entrySet().iterator(); 21 while ( iter.hasNext() ) { 22 Map.Entry me = (Map.Entry ) iter.next(); 23 buf.append(" if(") 24 .append( me.getKey() ) 25 .append(" is not null") 26 .append(", ") 27 .append( me.getValue() ) 28 .append(", "); 29 buf2.append(")"); 30 } 31 32 buf.append("null"); 33 buf.append(buf2); 34 if (returnColumnName!=null) { 35 buf.append(" as ") 36 .append(returnColumnName); 37 } 38 39 return buf.toString(); 40 } 41 } 42 43 | Popular Tags |