~ubuntu-branches/ubuntu/wily/libhibernate3-java/wily-proposed

« back to all changes in this revision

Viewing changes to src/org/hibernate/dialect/function/SQLFunction.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-10-14 14:43:34 UTC
  • Revision ID: james.westby@ubuntu.com-20071014144334-eamc8i0q10gs1aro
Tags: upstream-3.2.5
ImportĀ upstreamĀ versionĀ 3.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//$Id: SQLFunction.java 10775 2006-11-08 16:56:52Z steve.ebersole@jboss.com $
 
2
package org.hibernate.dialect.function;
 
3
 
 
4
import java.util.List;
 
5
 
 
6
import org.hibernate.QueryException;
 
7
import org.hibernate.engine.Mapping;
 
8
import org.hibernate.engine.SessionFactoryImplementor;
 
9
import org.hibernate.type.Type;
 
10
 
 
11
/**
 
12
 * Provides support routines for the HQL functions as used
 
13
 * in the various SQL Dialects
 
14
 *
 
15
 * Provides an interface for supporting various HQL functions that are
 
16
 * translated to SQL. The Dialect and its sub-classes use this interface to
 
17
 * provide details required for processing of the function.
 
18
 *
 
19
 * @author David Channon
 
20
 */
 
21
public interface SQLFunction {
 
22
        /**
 
23
         * The return type of the function.  May be either a concrete type which
 
24
         * is preset, or variable depending upon the type of the first function
 
25
         * argument.
 
26
         *
 
27
         * @param columnType the type of the first argument
 
28
         * @param mapping The mapping source.
 
29
         * @return The type to be expected as a return.
 
30
         * @throws org.hibernate.QueryException Indicates an issue resolving the return type.
 
31
         */
 
32
        public Type getReturnType(Type columnType, Mapping mapping) throws QueryException;
 
33
 
 
34
        /**
 
35
         * Does this function have any arguments?
 
36
         *
 
37
         * @return True if the function expects to have parameters; false otherwise.
 
38
         */
 
39
        public boolean hasArguments();
 
40
 
 
41
        /**
 
42
         * If there are no arguments, are parens required?
 
43
         *
 
44
         * @return True if a no-arg call of this function requires parentheses.
 
45
         */
 
46
        public boolean hasParenthesesIfNoArguments();
 
47
 
 
48
        /**
 
49
         * Render the function call as SQL fragment.
 
50
         * 
 
51
         * @param args The function arguments
 
52
         * @param factory The SessionFactory
 
53
         * @return The rendered function call
 
54
         * @throws org.hibernate.QueryException Indicates a problem rendering the
 
55
         * function call.
 
56
         */
 
57
        public String render(List args, SessionFactoryImplementor factory) throws QueryException;
 
58
}