KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > hql > ast > util > AliasGenerator


1 // $Id: AliasGenerator.java,v 1.1 2005/07/12 20:27:22 steveebersole Exp $
2
package org.hibernate.hql.ast.util;
3
4 import org.hibernate.util.StringHelper;
5
6 /**
7  * Generates class/table/column aliases during semantic analysis and SQL rendering.
8  * <p/>
9  * Its essential purpose is to keep an internal counter to ensure that the
10  * generated aliases are unique.
11  */

12 public class AliasGenerator {
13     private int next = 0;
14
15     private int nextCount() {
16         return next++;
17     }
18
19     public String JavaDoc createName(String JavaDoc name) {
20         return StringHelper.generateAlias( name, nextCount() );
21     }
22 }
23
Popular Tags