⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 noargsqlfunction.java

📁 一个Java持久层类库
💻 JAVA
字号:
//$Id: NoArgSQLFunction.java 6608 2005-04-29 15:32:30Z oneovthafew $package org.hibernate.dialect.function;import java.util.List;import org.hibernate.QueryException;import org.hibernate.engine.Mapping;import org.hibernate.engine.SessionFactoryImplementor;import org.hibernate.type.Type;/** * A function which takes no arguments * @author Michi */public class NoArgSQLFunction implements SQLFunction {    private Type returnType;    private boolean hasParenthesesIfNoArguments;    private String name;    public NoArgSQLFunction(String name, Type returnType) {        this(name, returnType, true);    }    public NoArgSQLFunction(String name, Type returnType, boolean hasParenthesesIfNoArguments) {        this.returnType = returnType;        this.hasParenthesesIfNoArguments = hasParenthesesIfNoArguments;        this.name = name;    }    public Type getReturnType(Type columnType, Mapping mapping) throws QueryException {        return returnType;    }    public boolean hasArguments() {        return false;    }    public boolean hasParenthesesIfNoArguments() {        return hasParenthesesIfNoArguments;    }        public String render(List args, SessionFactoryImplementor factory) throws QueryException {    	if ( args.size()>0 ) {    		throw new QueryException("function takes no arguments: " + name);    	}    	return hasParenthesesIfNoArguments ? name + "()" : name;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -