001package io.ebean.config; 002 003import io.ebean.annotation.Platform; 004import io.ebean.config.dbplatform.DbType; 005 006/** 007 * Custom mappings for DB types that override the default. 008 * 009 * @see DatabaseConfig#addCustomMapping(DbType, String) 010 */ 011public class CustomDbTypeMapping { 012 013 protected final DbType type; 014 015 protected final String columnDefinition; 016 017 protected final Platform platform; 018 019 /** 020 * Create a mapping. 021 */ 022 public CustomDbTypeMapping(DbType type, String columnDefinition, Platform platform) { 023 this.type = type; 024 this.columnDefinition = columnDefinition; 025 this.platform = platform; 026 } 027 028 /** 029 * Create a mapping that should apply to all the database platforms. 030 */ 031 public CustomDbTypeMapping(DbType type, String columnDefinition) { 032 this(type, columnDefinition, null); 033 } 034 035 /** 036 * Return the DB type the mapping applies to. 037 */ 038 public DbType getType() { 039 return type; 040 } 041 042 /** 043 * Return the DB column definition to use. 044 */ 045 public String getColumnDefinition() { 046 return columnDefinition; 047 } 048 049 /** 050 * Return the platform this mapping should apply to. Null means it applied to all platforms. 051 */ 052 public Platform getPlatform() { 053 return platform; 054 } 055}