FileDocCategorySizeDatePackage
StandardSQLFunction.javaAPI DocHibernate 3.2.52475Wed Nov 08 09:56:52 GMT 2006org.hibernate.dialect.function

StandardSQLFunction

public class StandardSQLFunction extends Object implements SQLFunction
Provides a standard implementation that supports the majority of the HQL functions that are translated to SQL. The Dialect and its sub-classes use this class to provide details required for processing of the associated function.
author
David Channon

Fields Summary
private final String
name
private final org.hibernate.type.Type
type
Constructors Summary
public StandardSQLFunction(String name)
Construct a standard SQL function definition with a variable return type; the actual return type will depend on the types to which the function is applied.

Using this form, the return type is considered non-static and assumed to be the type of the first argument.

param
name The name of the function.

		this( name, null );
	
public StandardSQLFunction(String name, org.hibernate.type.Type type)
Construct a standard SQL function definition with a static return type.

param
name The name of the function.
param
type The static return type.

		this.name = name;
		this.type = type;
	
Methods Summary
public java.lang.StringgetName()
Function name accessor

return
The function name.

		return name;
	
public org.hibernate.type.TypegetReturnType(org.hibernate.type.Type columnType, org.hibernate.engine.Mapping mapping)
{@inheritDoc}

		// return the concrete type, or the underlying type if a concrete type
		// was not specified
		return type == null ? columnType : type;
	
public org.hibernate.type.TypegetType()
Function static return type accessor.

return
The static function return type; or null if return type is not static.

		return type;
	
public booleanhasArguments()
{@inheritDoc}

		return true;
	
public booleanhasParenthesesIfNoArguments()
{@inheritDoc}

		return true;
	
public java.lang.Stringrender(java.util.List args, org.hibernate.engine.SessionFactoryImplementor factory)
{@inheritDoc}

		StringBuffer buf = new StringBuffer();
		buf.append( name ).append( '(" );
		for ( int i = 0; i < args.size(); i++ ) {
			buf.append( args.get( i ) );
			if ( i < args.size() - 1 ) {
				buf.append( ", " );
			}
		}
		return buf.append( ')" ).toString();
	
public java.lang.StringtoString()

		return name;