de.ispsoft.jaxme.generator
Interface SchemaSimpleType

All Superinterfaces:
SchemaType
All Known Subinterfaces:
AbstractType
All Known Implementing Classes:
SchemaSimpleTypeImpl, SimpleTypeWrapper, UserDefinedSimpleType

public interface SchemaSimpleType
extends SchemaType

An extension of the general SchemaType for simple types.

Author:
Jochen Wiedmann

Field Summary
static int OP_INSERT
          A possible mode for createPrepareStatement: The value is inserted into the database.
static int OP_UPDATE
          A possible mode for createPrepareStatement: The value is updated in the database.
static int OP_WHERE
          A possible mode for createPrepareStatement: The value is used in a where clause.
 
Method Summary
 java.lang.String castFromResultSet(java.lang.String pResultSet, int num)
          Returns a piece of Java code reading an instance of this type from a ResultSet.
 java.lang.String castFromString(java.lang.String pValue, java.lang.String pUnmarshaller)
          Returns a piece of Java code converting a String into an an instance of this type.
 java.lang.String castToPreparedStatement(java.lang.String pStatement, java.lang.String pValue, int num)
          Returns a piece of Java code writing an instance of this type into a prepared statement.
 java.lang.String castToString(java.lang.String pValue, java.lang.String pMarshaller)
          Returns a piece of Java code converting an instance of this type into a String.
 java.lang.String createPreparedStatementColumnName(SchemaAbstractSimpleElement pElement, int pMode, java.lang.String pColumnName)
          Creates SQL code for preparing a JDBC statement.
 java.lang.String createPreparedStatementColumnValue(SchemaAbstractSimpleElement pElement, int pMode)
          Creates SQL code for preparing a JDBC statement.
 int createPrepareStatement(SchemaAbstractSimpleElement pElement, JavaMethod pJm, int pNum, int pMode)
          Creates Java code for preparing a JDBC statement.
 void createSaxEvents(SchemaAbstractSimpleElement pElement, JavaMethod pJm, java.lang.String pFieldName, java.lang.String pMarshaller, java.lang.String pIndent)
          Creates Java code for firing SAX events.
 java.lang.String getClone(java.lang.String pValue)
          Returns a piece of Java code cloning an instance of this type.
 java.lang.String getCompare(java.lang.String p1, java.lang.String p2)
          Returns a piece of Java code that compares the given, non-null values.
 java.lang.String getPrimitiveRuntimeType()
          Returns the corresponding primitive type of the run-time class, or null.
 java.lang.String getQueryType()
          Returns the JMManager type for queries.
 java.lang.Class getRuntimeType()
          Returns the run-time class implementing this type.
 java.lang.String getSample(int pCount)
          Returns a sample value for the type.
 int[] getSQLTypes()
          Returns an array of SQL types that are matched by this type or null, if no SQL types apply.
 boolean hasPrimitive()
          Returns true, if this type has an associated primitive Java type.
 
Methods inherited from interface de.ispsoft.jaxme.generator.SchemaType
getClone, getLocalName, getNamespaceURI, isComplex
 

Field Detail

OP_INSERT

public static final int OP_INSERT

A possible mode for createPrepareStatement: The value is inserted into the database.

See Also:
createPrepareStatement(de.ispsoft.jaxme.generator.SchemaAbstractSimpleElement, de.ispsoft.jaxme.generator.javasource.JavaMethod, int, int), Constant Field Values

OP_UPDATE

public static final int OP_UPDATE

A possible mode for createPrepareStatement: The value is updated in the database.

See Also:
createPrepareStatement(de.ispsoft.jaxme.generator.SchemaAbstractSimpleElement, de.ispsoft.jaxme.generator.javasource.JavaMethod, int, int), Constant Field Values

OP_WHERE

public static final int OP_WHERE

A possible mode for createPrepareStatement: The value is used in a where clause.

See Also:
createPrepareStatement(de.ispsoft.jaxme.generator.SchemaAbstractSimpleElement, de.ispsoft.jaxme.generator.javasource.JavaMethod, int, int), Constant Field Values
Method Detail

hasPrimitive

public boolean hasPrimitive()

Returns true, if this type has an associated primitive Java type.


getPrimitiveRuntimeType

public java.lang.String getPrimitiveRuntimeType()

Returns the corresponding primitive type of the run-time class, or null.


getRuntimeType

public java.lang.Class getRuntimeType()

Returns the run-time class implementing this type.


castFromString

public java.lang.String castFromString(java.lang.String pValue,
                                       java.lang.String pUnmarshaller)

Returns a piece of Java code converting a String into an an instance of this type.

Parameters:
pValue - The value being converted, typically a variable name.
pUnmarshaller - A value with an UnmarshallerImpl being used, typically a variable name.

castToString

public java.lang.String castToString(java.lang.String pValue,
                                     java.lang.String pMarshaller)

Returns a piece of Java code converting an instance of this type into a String.

Parameters:
pValue - The value being converted, typically a variable name.
pMarshaller - A value with a MarshallerImpl being used, typically a variable name.

getSQLTypes

public int[] getSQLTypes()

Returns an array of SQL types that are matched by this type or null, if no SQL types apply.


castFromResultSet

public java.lang.String castFromResultSet(java.lang.String pResultSet,
                                          int num)

Returns a piece of Java code reading an instance of this type from a ResultSet.


castToPreparedStatement

public java.lang.String castToPreparedStatement(java.lang.String pStatement,
                                                java.lang.String pValue,
                                                int num)

Returns a piece of Java code writing an instance of this type into a prepared statement.


getQueryType

public java.lang.String getQueryType()

Returns the JMManager type for queries.


getClone

public java.lang.String getClone(java.lang.String pValue)

Returns a piece of Java code cloning an instance of this type.


getSample

public java.lang.String getSample(int pCount)

Returns a sample value for the type.


getCompare

public java.lang.String getCompare(java.lang.String p1,
                                   java.lang.String p2)

Returns a piece of Java code that compares the given, non-null values.


createPrepareStatement

public int createPrepareStatement(SchemaAbstractSimpleElement pElement,
                                  JavaMethod pJm,
                                  int pNum,
                                  int pMode)

Creates Java code for preparing a JDBC statement.

Parameters:
pElement - An atomic element whose value should be added as a parameter to the prepared statement
pJm - The Java method where to add source.
pNum - The parameter number: 1, 2, ...
pMode - Either of OP_INSERT, OP_UPDATE or OP_WHERE.
Returns:
The updated parameter number, if stmt.setXXX() was used.

createSaxEvents

public void createSaxEvents(SchemaAbstractSimpleElement pElement,
                            JavaMethod pJm,
                            java.lang.String pFieldName,
                            java.lang.String pMarshaller,
                            java.lang.String pIndent)

Creates Java code for firing SAX events.

Parameters:
pElement - An atomic element whose value should be converted into SAX events.
pJm - The Java method where to add source.
pFieldName - The field name to use for reading the values
pMarshaller - The field name of a Marshaller to use
pIndent - String of blanks for indenting the generated source

createPreparedStatementColumnName

public java.lang.String createPreparedStatementColumnName(SchemaAbstractSimpleElement pElement,
                                                          int pMode,
                                                          java.lang.String pColumnName)

Creates SQL code for preparing a JDBC statement.

Parameters:
pElement - An atomic element whose value should be added as a parameter to the prepared statement.
pMode - Either of OP_INSERT, OP_UPDATE or OP_WHERE.
pColumnName - A suggested column name.
Returns:
An SQL expression specifying a column name that is to be inserted or updated. NULL if the column should be omitted.

createPreparedStatementColumnValue

public java.lang.String createPreparedStatementColumnValue(SchemaAbstractSimpleElement pElement,
                                                           int pMode)

Creates SQL code for preparing a JDBC statement.

Parameters:
pElement - An atomic element whose value should be added as a parameter to the prepared statement.
pMode - Either of OP_INSERT, OP_UPDATE or OP_WHERE.
Returns:
An SQL expression specifying a column value that is to be inserted or updated. NULL if the column should be omitted.