Class DbPlatformType

    • Constructor Detail

      • DbPlatformType

        public DbPlatformType​(String name,
                              int defaultLength)
        Construct with a given length.
      • DbPlatformType

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

        public DbPlatformType​(String name,
                              boolean canHaveLength)
        Use with canHaveLength=false for types that should never have a length.
        name - the type name
        canHaveLength - set this to false for type that should never have a length
    • Method Detail

      • parse

        public static DbPlatformType parse​(String columnDefinition)
        Parse a type definition into a DbPlatformType.

        e.g. "decimal(18,6)" e.g. "text"

      • getDefaultLength

        public int getDefaultLength()
        Return the default length/precision.
      • 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.

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

        public String renderType​(int deployLength,
                                 int deployScale,
                                 boolean strict)
        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.

      • withLength

        public DbPlatformType withLength​(int defaultLength)
        Create a copy of the type with a new default length.