org.jooq.impl
Class SchemaImpl

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

public class SchemaImpl
extends Object
implements Schema

Author:
Lukas Eder
See Also:
Serialized Form

Constructor Summary
SchemaImpl(SQLDialect dialect, String name)
           
 
Method Summary
protected  void addMapping(String name, Class<?> type)
           
 void attach(Configuration c)
          Attach this record to a new Configuration
 int bind(Configuration c, PreparedStatement stmt)
          Bind all parameters of this QueryPart to a PreparedStatement.
 int bind(Configuration c, PreparedStatement stmt, int initialIndex)
          Bind all parameters of this QueryPart to a PreparedStatement.
 int bindDeclaration(Configuration configuration, PreparedStatement stmt)
          Bind all parameters of this QueryPart to a PreparedStatement.
 int bindDeclaration(Configuration configuration, PreparedStatement stmt, int initialIndex)
          The default implementation is the same as that of QueryPartInternal.bindReference(Configuration, PreparedStatement, int).
 int bindReference(Configuration configuration, PreparedStatement stmt)
          Bind all parameters of this QueryPart to a PreparedStatement.
 int bindReference(Configuration configuration, PreparedStatement stmt, int initialIndex)
          Bind all parameters of this QueryPart to a PreparedStatement.
 int compareTo(NamedQueryPart that)
           
protected  Factory create()
          Internal convenience method
 boolean equals(Object that)
           
 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
 Configuration getConfiguration()
          Get the underlying configuration
 SQLDialect getDialect()
          Reproduce the SQL dialect this QueryPart was created with This method is for JOOQ INTERNAL USE only.
 String getName()
          The name of this query part
 List<Sequence> getSequences()
          List all sequences contained in this schema
 String getSQL()
          Retrieve the SQL code rendered by this query part.
 List<Table<?>> getTables()
          List all tables contained in this schema
 Map<String,Class<?>> getTypeMapping()
          The complete type mapping for this schema.
 List<UDT<?>> getUDTs()
          List all UDTs contained in this schema
 int hashCode()
           
protected  AttachableInternal internal(Attachable part)
           
protected  QueryPartInternal internal(QueryPart part)
           
<T> T
internalAPI(Class<T> internalType)
          Adapt to an internal type assuming its functionality This is for JOOQ INTERNAL USE only.
 String toSQLDeclaration(Configuration c)
          Transform this object into SQL, such that it can be used as a declaration.
 String toSQLDeclaration(Configuration c, boolean inlineParameters)
          The default implementation is the same as that of QueryPartInternal.toSQLReference(Configuration, boolean).
 String toSQLReference(Configuration c)
          Transform this object into SQL, such that it can be used as a reference.
 String toSQLReference(Configuration configuration, boolean inlineParameters)
          Transform this object into SQL, such that it can be used as a reference.
 String toString()
           
protected  String wrapInParentheses(String sql)
          Wrap a piece of SQL code in parentheses, if not wrapped already
 
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.QueryPart
getSQL
 
Methods inherited from interface org.jooq.Attachable
attach, getConfiguration
 
Methods inherited from interface org.jooq.Adapter
internalAPI
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

SchemaImpl

public SchemaImpl(SQLDialect dialect,
                  String name)
Method Detail

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

bindReference

public final int bindReference(Configuration configuration,
                               PreparedStatement stmt,
                               int initialIndex)
                        throws SQLException
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:
bindReference in interface QueryPartInternal
Parameters:
configuration - The configuration overriding dialects and schemata
stmt - The statement to bind values to
initialIndex - The index of the next binding variable
Returns:
The index of the next binding variable
Throws:
SQLException

toSQLReference

public final String toSQLReference(Configuration configuration,
                                   boolean inlineParameters)
Description copied from interface: QueryPartInternal
Transform this object into SQL, such that it can be used as a reference.

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

Specified by:
toSQLReference in interface QueryPartInternal
Parameters:
configuration - The configuration overriding dialects and schemata
inlineParameters - if set to true, all parameters are inlined, not replaced by "?"
Returns:
SQL representation of this QueryPart

getTypeMapping

public final Map<String,Class<?>> getTypeMapping()
                                          throws SQLException
Description copied from interface: Schema
The complete type mapping for this schema.

This method returns all generated types involved with this schema. The result can be used in ResultSet.getObject(int, Map) and similar methods.

Specified by:
getTypeMapping in interface Schema
Throws:
SQLException
See Also:
for a UDT-specific type mapping

addMapping

protected final void addMapping(String name,
                                Class<?> type)

getTables

public List<Table<?>> getTables()
List all tables contained in this schema

Subclasses should override this method

Specified by:
getTables in interface Schema

getUDTs

public List<UDT<?>> getUDTs()
List all UDTs contained in this schema

Subclasses should override this method

Specified by:
getUDTs in interface Schema

getSequences

public List<Sequence> getSequences()
List all sequences contained in this schema

Subclasses should override this method

Specified by:
getSequences in interface 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 <T> T internalAPI(Class<T> 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:
T - The internal type's generic type parameter.
Parameters:
internalType - The internal type
Returns:
This object wrapped by or cast to an internal type

internal

protected final AttachableInternal internal(Attachable part)

internal

protected final QueryPartInternal internal(QueryPart part)

getSQL

public final String getSQL()
Description copied from interface: QueryPart
Retrieve the SQL code rendered by this query part.

Specified by:
getSQL in interface QueryPart

attach

public final void attach(Configuration c)
Description copied from interface: Attachable
Attach this record to a new Configuration

Specified by:
attach in interface Attachable

getConfiguration

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

Specified by:
getConfiguration in interface Attachable
Specified by:
getConfiguration in interface AttachableInternal

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


toSQLReference

public final String toSQLReference(Configuration c)
Description copied from interface: QueryPartInternal
Transform this object into SQL, such that it can be used as a reference. This always results in calling toSQLReference(configuration, false)

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

Specified by:
toSQLReference in interface QueryPartInternal
Parameters:
c - The configuration overriding dialects and schemata
Returns:
SQL representation of this QueryPart
See Also:
QueryPartInternal.toSQLReference(Configuration, boolean)

toSQLDeclaration

public final String toSQLDeclaration(Configuration c)
Description copied from interface: QueryPartInternal
Transform this object into SQL, such that it can be used as a declaration. Usually, this is the same as calling toSQLReference(configuration, false)

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

Specified by:
toSQLDeclaration in interface QueryPartInternal
Parameters:
c - The configuration overriding dialects and schemata
Returns:
SQL representation of this QueryPart
See Also:
QueryPartInternal.toSQLDeclaration(Configuration, boolean)

toSQLDeclaration

public String toSQLDeclaration(Configuration c,
                               boolean inlineParameters)
The default implementation is the same as that of QueryPartInternal.toSQLReference(Configuration, boolean). Subclasses may override this method.

Specified by:
toSQLDeclaration in interface QueryPartInternal
Parameters:
c - The configuration overriding dialects and schemata
inlineParameters - if set to true, all parameters are inlined, not replaced by "?"
Returns:
SQL representation of this QueryPart

bind

public final int bind(Configuration c,
                      PreparedStatement stmt)
               throws SQLException
Description copied from interface: QueryPartInternal
Bind all parameters of this QueryPart to a PreparedStatement. This always results in calling bind(configuration, stmt, 1)

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

Specified by:
bind in interface QueryPartInternal
Parameters:
c - The configuration overriding dialects and schemata
stmt - The statement to bind values to
Returns:
The index of the next binding variable
Throws:
SQLException
See Also:
QueryPartInternal.bind(Configuration, PreparedStatement, int)

bind

public final int bind(Configuration c,
                      PreparedStatement stmt,
                      int initialIndex)
               throws SQLException
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:
c - The configuration overriding dialects and schemata
stmt - The statement to bind values to
initialIndex - The index of the next binding variable
Returns:
The index of the next binding variable
Throws:
SQLException

bindReference

public final int bindReference(Configuration configuration,
                               PreparedStatement stmt)
                        throws SQLException
Description copied from interface: QueryPartInternal
Bind all parameters of this QueryPart to a PreparedStatement. This always results in calling bind(configuration, stmt, 1)

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

Specified by:
bindReference in interface QueryPartInternal
Parameters:
configuration - The configuration overriding dialects and schemata
stmt - The statement to bind values to
Returns:
The index of the next binding variable
Throws:
SQLException
See Also:
QueryPartInternal.bind(Configuration, PreparedStatement, int)

bindDeclaration

public final int bindDeclaration(Configuration configuration,
                                 PreparedStatement stmt)
                          throws SQLException
Description copied from interface: QueryPartInternal
Bind all parameters of this QueryPart to a PreparedStatement. This always results in calling bind(configuration, stmt, 1)

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

Specified by:
bindDeclaration in interface QueryPartInternal
Parameters:
configuration - The configuration overriding dialects and schemata
stmt - The statement to bind values to
Returns:
The index of the next binding variable
Throws:
SQLException
See Also:
QueryPartInternal.bind(Configuration, PreparedStatement, int)

bindDeclaration

public int bindDeclaration(Configuration configuration,
                           PreparedStatement stmt,
                           int initialIndex)
                    throws SQLException
The default implementation is the same as that of QueryPartInternal.bindReference(Configuration, PreparedStatement, int). Subclasses may override this method.

Specified by:
bindDeclaration in interface QueryPartInternal
Parameters:
configuration - The configuration overriding dialects and schemata
stmt - The statement to bind values to
initialIndex - The index of the next binding variable
Returns:
The index of the next binding variable
Throws:
SQLException

equals

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

hashCode

public final int hashCode()
Overrides:
hashCode in class Object

toString

public final String toString()
Overrides:
toString in class Object

getDialect

public final SQLDialect getDialect()
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

wrapInParentheses

protected final String wrapInParentheses(String sql)
Wrap a piece of SQL code in parentheses, if not wrapped already



Copyright © 2011. All Rights Reserved.