com.avaje.ebean.config.dbplatform
Class DbType

java.lang.Object
  extended by com.avaje.ebean.config.dbplatform.DbType
Direct Known Subclasses:
MySqlBlob, MySqlClob

public class DbType
extends Object

    

Represents a DB type with name, length, precision, and scale.

The length is for VARCHAR types and precision/scale for DECIMAL types.


Constructor Summary
DbType(String name)
          Construct with no length or scale.
DbType(String name, boolean canHaveLength)
          Use with canHaveLength=false for types that should never have a length.
DbType(String name, int defaultLength)
          Construct with a given length.
DbType(String name, int defaultPrecision, int defaultScale)
          Construct for Decimal with precision and scale.
 
Method Summary
 String renderType(int deployLength, int deployScale)
          Return the type for a specific property that incorporates the name, length, precision and scale.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbType

public DbType(String name)
Construct with no length or scale.


DbType

public DbType(String name,
              int defaultLength)
Construct with a given length.


DbType

public DbType(String name,
              int defaultPrecision,
              int defaultScale)
Construct for Decimal with precision and scale.


DbType

public DbType(String name,
              boolean canHaveLength)
Use with canHaveLength=false for types that should never have a length.

Parameters:
name - the type name
canHaveLength - set this to false for type that should never have a length
Method Detail

renderType

public String renderType(int deployLength,
                         int deployScale)
Return the type for a specific property that incorporates the name, length, precision and scale.

The deployLength and deployScale are for the property we are rendering the DB type for.

Parameters:
deployLength - the length or precision defined by deployment on a specific property.
deployScale - the scale defined by deployment on a specific property.


Copyright © 2010. All Rights Reserved.