org.sandev.generator
Class PostgreSQLStructMapper

java.lang.Object
  extended by org.sandev.generator.DefaultSQLStructMapper
      extended by org.sandev.generator.PostgreSQLStructMapper
All Implemented Interfaces:
StructMapper

public class PostgreSQLStructMapper
extends DefaultSQLStructMapper
implements StructMapper

A StructMapper for PostgreSQL database tables. This addresses the following issues that make PostgreSQL different from the DefaultSQLStructMapper:

Rather than reimplementing methods that are the same, this class extends the default.


Constructor Summary
PostgreSQLStructMapper()
           
 
Method Summary
 java.lang.String getMappedFieldName(com.sun.javadoc.ClassDoc struct, com.sun.javadoc.FieldDoc field)
          PostgreSQL prevents some reserved words from being used as column names unless they're quoted.
 java.lang.String getMappedFieldType(com.sun.javadoc.ClassDoc struct, com.sun.javadoc.FieldDoc field)
          Field overrides for PostgreSQL.
 
Methods inherited from class org.sandev.generator.DefaultSQLStructMapper
getMappedFieldRelation, getMappedFieldRelationChild, getMappedFieldRelationIndex, getMappedFieldRelationParent, getMappedStructName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sandev.generator.StructMapper
getMappedFieldRelation, getMappedFieldRelationChild, getMappedFieldRelationIndex, getMappedFieldRelationParent, getMappedStructName
 

Constructor Detail

PostgreSQLStructMapper

public PostgreSQLStructMapper()
Method Detail

getMappedFieldName

public java.lang.String getMappedFieldName(com.sun.javadoc.ClassDoc struct,
                                           com.sun.javadoc.FieldDoc field)
PostgreSQL prevents some reserved words from being used as column names unless they're quoted. Quoting doesn't fit well with the existing SQL generators, so append "_ref" to the field name.

Specified by:
getMappedFieldName in interface StructMapper
Overrides:
getMappedFieldName in class DefaultSQLStructMapper

getMappedFieldType

public java.lang.String getMappedFieldType(com.sun.javadoc.ClassDoc struct,
                                           com.sun.javadoc.FieldDoc field)
Field overrides for PostgreSQL. PostgreSQL doesn't like "double" and insists on "double precision" instead.

Specified by:
getMappedFieldType in interface StructMapper
Overrides:
getMappedFieldType in class DefaultSQLStructMapper