java.lang.Object
io.ebean.config.dbplatform.DbPlatformType
- All Implemented Interfaces:
ExtraDbTypes
Represents a DB type with name, length, precision, and scale.
The length is for VARCHAR types and precision/scale for DECIMAL types.
-
Field Summary
Fields inherited from interface io.ebean.config.dbplatform.ExtraDbTypes
CIDR, HSTORE, INET, JSON, JSONB, JSONBlob, JSONClob, JSONVarchar, LINESTRING, LOCALDATETIME, MULTILINESTRING, MULTIPOINT, MULTIPOLYGON, POINT, POLYGON, UUID
-
Constructor Summary
ConstructorDescriptionDbPlatformType
(String name) Construct with no length or scale.DbPlatformType
(String name, boolean canHaveLength) Use with canHaveLength=false for types that should never have a length.DbPlatformType
(String name, int defaultLength) Construct with a given length.DbPlatformType
(String name, int defaultPrecision, int defaultScale) Construct for Decimal with precision and scale. -
Method Summary
Modifier and TypeMethodDescriptionint
Return the default length/precision.int
Return the default scale.getName()
Return the type name.static DbPlatformType
Parse a type definition into a DbPlatformType.protected void
renderLengthScale
(int deployLength, int deployScale, StringBuilder sb) Render the length and scale part of the column definition.renderType
(int deployLength, int deployScale) Return the type for a specific property that incorporates the name, length, precision and scale.renderType
(int deployLength, int deployScale, boolean strict) Render the type defining strict mode.withLength
(int defaultLength) Create a copy of the type with a new default length.
-
Constructor Details
-
DbPlatformType
Construct with no length or scale. -
DbPlatformType
Construct with a given length. -
DbPlatformType
Construct for Decimal with precision and scale. -
DbPlatformType
Use with canHaveLength=false for types that should never have a length.- Parameters:
name
- the type namecanHaveLength
- set this to false for type that should never have a length
-
-
Method Details
-
parse
Parse a type definition into a DbPlatformType.e.g. "decimal(18,6)" e.g. "text"
-
getName
Return the type name. -
getDefaultLength
public int getDefaultLength()Return the default length/precision. -
getDefaultScale
public int getDefaultScale()Return the default scale. -
renderType
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.
-
renderType
Render the type defining strict mode.If strict mode if OFF then this will render with a scale value even if that is not strictly supported. The reason for supporting this is to enable use to use types like jsonb(200) as a "logical" type that maps to JSONB for Postgres and VARCHAR(200) for other databases.
-
renderLengthScale
Render the length and scale part of the column definition. -
withLength
Create a copy of the type with a new default length.
-