1 package org.hibernate.sql; 3 4 import java.util.Map ; 5 6 import org.hibernate.util.StringHelper; 7 8 import org.apache.commons.collections.SequencedHashMap; 9 10 15 public abstract class CaseFragment { 16 public abstract String toFragmentString(); 17 18 protected String returnColumnName; 19 20 protected Map cases = new SequencedHashMap(); 21 22 public CaseFragment setReturnColumnName(String returnColumnName) { 23 this.returnColumnName = returnColumnName; 24 return this; 25 } 26 27 public CaseFragment setReturnColumnName(String returnColumnName, String suffix) { 28 return setReturnColumnName( new Alias(suffix).toAliasString(returnColumnName) ); 29 } 30 31 public CaseFragment addWhenColumnNotNull(String alias, String columnName, String value) { 32 cases.put( StringHelper.qualify(alias, columnName), value ); 33 return this; 34 } 35 } 36 | Popular Tags |