📄 varargssqlfunction.java
字号:
//$Id: VarArgsSQLFunction.java,v 1.1 2005/04/13 04:44:35 oneovthafew Exp $
package org.hibernate.dialect.function;
import java.util.List;
import org.hibernate.QueryException;
import org.hibernate.engine.Mapping;
import org.hibernate.type.Type;
public class VarArgsSQLFunction implements SQLFunction {
private String begin;
private String sep;
private String end;
private Type type;
public VarArgsSQLFunction(Type type, String begin, String sep, String end) {
this.begin = begin;
this.sep = sep;
this.end = end;
this.type = type;
}
public Type getReturnType(Type columnType, Mapping mapping) throws QueryException {
return type;
}
public boolean hasArguments() {
return true;
}
public boolean hasParenthesesIfNoArguments() {
return true;
}
public String render(List args) throws QueryException {
StringBuffer buf = new StringBuffer().append(begin);
for ( int i=0; i<args.size(); i++ ) {
buf.append( args.get(i) );
if (i<args.size()-1) buf.append(sep);
}
return buf.append(end).toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -