org.jooq.impl
Class AbstractRoutine<T>

java.lang.Object
  extended by org.jooq.impl.AbstractRoutine<T>
All Implemented Interfaces:
Serializable, Comparable<NamedQueryPart>, Adapter, Attachable, AttachableInternal, NamedQueryPart, QueryPart, QueryPartInternal, Routine<T>, SchemaProvider

public abstract class AbstractRoutine<T>
extends Object
implements Routine<T>

A common base class for stored procedures

This type is for JOOQ INTERNAL USE only. Do not reference directly

Author:
Lukas Eder
See Also:
Serialized Form

Constructor Summary
protected AbstractRoutine(SQLDialect dialect, String name, Schema schema)
          Deprecated. - 2.1.0 [#625] - Regenerate your schema
protected AbstractRoutine(SQLDialect dialect, String name, Schema schema, DataType<T> type)
          Deprecated. - 2.1.0 [#625] - Regenerate your schema
protected AbstractRoutine(SQLDialect dialect, String name, Schema schema, Package pkg)
          Deprecated. - 2.1.0 [#625] - Regenerate your schema
protected AbstractRoutine(SQLDialect dialect, String name, Schema schema, Package pkg, DataType<T> type)
          Deprecated. - 2.1.0 [#625] - Regenerate your schema
protected AbstractRoutine(String name, Schema schema)
           
protected AbstractRoutine(String name, Schema schema, DataType<T> type)
           
protected AbstractRoutine(String name, Schema schema, Package pkg)
           
protected AbstractRoutine(String name, Schema schema, Package pkg, DataType<T> type)
           
 
Method Summary
protected  void addInOutParameter(Parameter<?> parameter)
           
protected  void addInParameter(Parameter<?> parameter)
           
protected  void addOutParameter(Parameter<?> parameter)
           
 Field<T> asField()
           
 Field<T> asField(String alias)
           
 void attach(Configuration configuration)
          By default, nothing is done on an attachment event.
 void bind(BindContext context)
          Bind all parameters of this QueryPart to a PreparedStatement This method is for JOOQ INTERNAL USE only.
 int compareTo(NamedQueryPart that)
           
protected  Factory create()
          Internal convenience method
protected  Factory create(Configuration configuration)
          Internal convenience method
protected static
<T> Parameter<T>
createParameter(String name, DataType<T> type)
          Subclasses may call this method to create UDTField objects that are linked to this table.
protected static
<T> Parameter<T>
createParameter(String name, DataType<T> type, boolean isDefaulted)
          Subclasses may call this method to create UDTField objects that are linked to this table.
 boolean declaresFields()
          Subclasses may override this
 boolean declaresTables()
          Subclasses may override this
 boolean equals(Object that)
           
 int execute()
          Execute the stored object on an underlying connection
 int execute(Configuration configuration)
          Execute the stored object using a Configuration object
 List<Attachable> getAttachables()
          Get the list of dependent Attachables This method is for JOOQ INTERNAL USE only.
protected  List<Attachable> getAttachables(Collection<? extends QueryPart> list)
          Internal convenience method
protected  List<Attachable> getAttachables(QueryPart... list)
          Internal convenience method
protected  List<Attachable> getAttachables(Store<?> store)
          Internal convenience method
protected  List<Attachable> getAttachables0()
           
 List<Object> getBindValues()
          This method is also declared as Query.getBindValues() Retrieve the bind values that will be bound by this QueryPart This method is exposed publicly in Query.getBindValues()
 Configuration getConfiguration()
          Get the underlying configuration
 SQLDialect getDialect()
          Deprecated. 
 List<Parameter<?>> getInParameters()
          A list of IN parameters passed to the stored procedure as argument.
protected  Map<Parameter<?>,Field<?>> getInValues()
           
 String getName()
          The name of this query part
 List<Parameter<?>> getOutParameters()
          A list of OUT parameters passed to the stored procedure as argument.
 Package getPackage()
          The container package of this stored procedure or function.
 Param<?> getParam(String name)
          This method is also declared as Query.getParam(String) Retrieve a named parameter that will be bound by this QueryPart This method is exposed publicly in Query.getParam(String)
 List<Parameter<?>> getParameters()
           
 Map<String,Param<?>> getParams()
          This method is also declared as Query.getParams() Retrieve the named parameters that will be bound by this QueryPart This method is exposed publicly in Query.getParams()
protected  Parameter<?> getReturnParameter()
           
 T getReturnValue()
           
 Schema getSchema()
           
 String getSQL()
          This method is also declared as Query.getSQL() Retrieve the SQL that will be rendered by this QueryPart This method is exposed publicly in Query.getSQL()
 String getSQL(boolean inline)
          This method is also declared as Query.getSQL(boolean) Retrieve the SQL that will be rendered by this QueryPart This method is exposed publicly in Query.getSQL(boolean)
protected
<Z> Z
getValue(Parameter<Z> parameter)
           
 int hashCode()
           
<I> I
internalAPI(Class<I> internalType)
          Adapt to an internal type assuming its functionality This is for JOOQ INTERNAL USE only.
protected  boolean isOverloaded()
           
protected  void setField(Parameter<?> parameter, Field<?> value)
           
protected  void setNumber(Parameter<? extends Number> parameter, Field<? extends Number> value)
           
protected  void setNumber(Parameter<? extends Number> parameter, Number value)
           
protected  void setOverloaded(boolean overloaded)
           
protected  void setReturnParameter(Parameter<T> parameter)
           
protected  void setValue(Parameter<?> parameter, Object value)
           
 void toSQL(RenderContext context)
          Render this QueryPart to a SQL string contained in context.sql().
 String toString()
           
protected  DataAccessException translate(String task, String sql, SQLException e)
          Internal convenience method
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jooq.NamedQueryPart
getName
 
Methods inherited from interface org.jooq.Adapter
internalAPI
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.jooq.SchemaProvider
getSchema
 

Constructor Detail

AbstractRoutine

@Deprecated
protected AbstractRoutine(SQLDialect dialect,
                                     String name,
                                     Schema schema)
Deprecated. - 2.1.0 [#625] - Regenerate your schema


AbstractRoutine

@Deprecated
protected AbstractRoutine(SQLDialect dialect,
                                     String name,
                                     Schema schema,
                                     Package pkg)
Deprecated. - 2.1.0 [#625] - Regenerate your schema


AbstractRoutine

@Deprecated
protected AbstractRoutine(SQLDialect dialect,
                                     String name,
                                     Schema schema,
                                     DataType<T> type)
Deprecated. - 2.1.0 [#625] - Regenerate your schema


AbstractRoutine

@Deprecated
protected AbstractRoutine(SQLDialect dialect,
                                     String name,
                                     Schema schema,
                                     Package pkg,
                                     DataType<T> type)
Deprecated. - 2.1.0 [#625] - Regenerate your schema


AbstractRoutine

protected AbstractRoutine(String name,
                          Schema schema)

AbstractRoutine

protected AbstractRoutine(String name,
                          Schema schema,
                          Package pkg)

AbstractRoutine

protected AbstractRoutine(String name,
                          Schema schema,
                          DataType<T> type)

AbstractRoutine

protected AbstractRoutine(String name,
                          Schema schema,
                          Package pkg,
                          DataType<T> type)
Method Detail

setNumber

protected final void setNumber(Parameter<? extends Number> parameter,
                               Number value)

setNumber

protected final void setNumber(Parameter<? extends Number> parameter,
                               Field<? extends Number> value)

setValue

protected final void setValue(Parameter<?> parameter,
                              Object value)

setField

protected final void setField(Parameter<?> parameter,
                              Field<?> value)

attach

public final void attach(Configuration configuration)
By default, nothing is done on an attachment event. Subclasses may override this, however, in order to receive a connection when needed

Specified by:
attach in interface Attachable

getAttachables0

protected final List<Attachable> getAttachables0()

execute

public final int execute(Configuration configuration)
Description copied from interface: Routine
Execute the stored object using a Configuration object

Specified by:
execute in interface Routine<T>

execute

public final int execute()
Description copied from interface: Routine
Execute the stored object on an underlying connection

Specified by:
execute in interface Routine<T>

bind

public final void bind(BindContext context)
Description copied from interface: QueryPartInternal
Bind all parameters of this QueryPart to a PreparedStatement

This method is for JOOQ INTERNAL USE only. Do not reference directly

Specified by:
bind in interface QueryPartInternal
Parameters:
context - The context holding the next bind index and other information for variable binding

toSQL

public final void toSQL(RenderContext context)
Description copied from interface: QueryPartInternal
Render this QueryPart to a SQL string contained in context.sql(). The context will contain additional information about how to render this QueryPart, e.g. whether this QueryPart should be rendered as a declaration or reference, whether this QueryPart's contained bind variables should be inlined or replaced by '?', etc.

Specified by:
toSQL in interface QueryPartInternal

getReturnValue

public final T getReturnValue()
Specified by:
getReturnValue in interface Routine<T>
Returns:
The routine's return value (if it is a function)

getValue

protected final <Z> Z getValue(Parameter<Z> parameter)

getInValues

protected final Map<Parameter<?>,Field<?>> getInValues()

getOutParameters

public final List<Parameter<?>> getOutParameters()
Description copied from interface: Routine
A list of OUT parameters passed to the stored procedure as argument. This list contains all parameters that are either OUT or INOUT in their respective order of appearance in Routine.getParameters().

Specified by:
getOutParameters in interface Routine<T>
Returns:
The list of out parameters
See Also:
Routine.getParameters()

getInParameters

public final List<Parameter<?>> getInParameters()
Description copied from interface: Routine
A list of IN parameters passed to the stored procedure as argument. This list contains all parameters that are either IN or INOUT in their respective order of appearance in Routine.getParameters().

Specified by:
getInParameters in interface Routine<T>
Returns:
The list of in parameters
See Also:
Routine.getParameters()

getParameters

public final List<Parameter<?>> getParameters()
Specified by:
getParameters in interface Routine<T>
Returns:
A list of parameters passed to the stored object as argument

getPackage

public final Package getPackage()
Description copied from interface: Routine
The container package of this stored procedure or function.

This is only supported in the SQLDialect.ORACLE dialect.

Specified by:
getPackage in interface Routine<T>
Returns:
The container package of this object, or null if there is no such container.

getReturnParameter

protected final Parameter<?> getReturnParameter()

setOverloaded

protected final void setOverloaded(boolean overloaded)

isOverloaded

protected final boolean isOverloaded()

addInParameter

protected final void addInParameter(Parameter<?> parameter)

addInOutParameter

protected final void addInOutParameter(Parameter<?> parameter)

addOutParameter

protected final void addOutParameter(Parameter<?> parameter)

setReturnParameter

protected final void setReturnParameter(Parameter<T> parameter)

asField

public final Field<T> asField()

asField

public final Field<T> asField(String alias)

createParameter

protected static final <T> Parameter<T> createParameter(String name,
                                                        DataType<T> type)
Subclasses may call this method to create UDTField objects that are linked to this table.

Parameters:
name - The name of the field (case-sensitive!)
type - The data type of the field

createParameter

protected static final <T> Parameter<T> createParameter(String name,
                                                        DataType<T> type,
                                                        boolean isDefaulted)
Subclasses may call this method to create UDTField objects that are linked to this table.

Parameters:
name - The name of the field (case-sensitive!)
type - The data type of the field
isDefaulted - Whether the parameter is defaulted (see Parameter.isDefaulted()

getAttachables

public final List<Attachable> getAttachables()
Description copied from interface: AttachableInternal
Get the list of dependent Attachables

This method is for JOOQ INTERNAL USE only. Do not reference directly

Specified by:
getAttachables in interface AttachableInternal

getSchema

public final Schema getSchema()
Specified by:
getSchema in interface SchemaProvider
Returns:
The contained schema

getName

public final String getName()
Description copied from interface: NamedQueryPart
The name of this query part

Specified by:
getName in interface NamedQueryPart

compareTo

public final int compareTo(NamedQueryPart that)
Specified by:
compareTo in interface Comparable<NamedQueryPart>

internalAPI

public final <I> I internalAPI(Class<I> internalType)
Description copied from interface: Adapter
Adapt to an internal type assuming its functionality

This is for JOOQ INTERNAL USE only. If you need to access the internal API, these are the known possible interfaces:

Be aware though, that the internal API may change even between minor releases.

Specified by:
internalAPI in interface Adapter
Type Parameters:
I - The internal type's generic type parameter.
Parameters:
internalType - The internal type
Returns:
This object wrapped by or cast to an internal type

getConfiguration

public final Configuration getConfiguration()
Description copied from interface: AttachableInternal
Get the underlying configuration

Specified by:
getConfiguration in interface AttachableInternal

getDialect

@Deprecated
public final SQLDialect getDialect()
Deprecated. 

Description copied from interface: QueryPartInternal
Reproduce the SQL dialect this QueryPart was created with

This method is for JOOQ INTERNAL USE only. Do not reference directly

Specified by:
getDialect in interface QueryPartInternal
Returns:
The SQL dialect

getSQL

public final String getSQL()
This method is also declared as Query.getSQL()

Retrieve the SQL that will be rendered by this QueryPart

This method is exposed publicly in Query.getSQL()

Specified by:
getSQL in interface QueryPartInternal

getSQL

public final String getSQL(boolean inline)
This method is also declared as Query.getSQL(boolean)

Retrieve the SQL that will be rendered by this QueryPart

This method is exposed publicly in Query.getSQL(boolean)

Specified by:
getSQL in interface QueryPartInternal

getBindValues

public final List<Object> getBindValues()
This method is also declared as Query.getBindValues()

Retrieve the bind values that will be bound by this QueryPart

This method is exposed publicly in Query.getBindValues()

Specified by:
getBindValues in interface QueryPartInternal

getParams

public final Map<String,Param<?>> getParams()
This method is also declared as Query.getParams()

Retrieve the named parameters that will be bound by this QueryPart

This method is exposed publicly in Query.getParams()

Specified by:
getParams in interface QueryPartInternal

getParam

public final Param<?> getParam(String name)
This method is also declared as Query.getParam(String)

Retrieve a named parameter that will be bound by this QueryPart

This method is exposed publicly in Query.getParam(String)

Specified by:
getParam in interface QueryPartInternal

declaresFields

public boolean declaresFields()
Subclasses may override this

Specified by:
declaresFields in interface QueryPartInternal

declaresTables

public boolean declaresTables()
Subclasses may override this

Specified by:
declaresTables in interface QueryPartInternal

equals

public boolean equals(Object that)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

getAttachables

protected final List<Attachable> getAttachables(Collection<? extends QueryPart> list)
Internal convenience method


getAttachables

protected final List<Attachable> getAttachables(QueryPart... list)
Internal convenience method


getAttachables

protected final List<Attachable> getAttachables(Store<?> store)
Internal convenience method


create

protected final Factory create()
Internal convenience method


create

protected final Factory create(Configuration configuration)
Internal convenience method


translate

protected final DataAccessException translate(String task,
                                              String sql,
                                              SQLException e)
Internal convenience method



Copyright © 2012. All Rights Reserved.