mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
#824 - Refactor com.avaje.ebean.config.dbplatform DbType & DbPlatformType
This commit is contained in:
1 parent
bc4a246f33
commit
d0ad5f6c48
40 files changed
+652
-513
No files matched your search
@@ -5,7 +5,7 @@ import com.avaje.ebean.bean.EntityBean;
|
||||
import com.avaje.ebean.bean.PersistenceContext;
|
||||
import com.avaje.ebean.config.EncryptKey;
|
||||
import com.avaje.ebean.config.dbplatform.DbEncryptFunction;
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformType;
|
||||
import com.avaje.ebean.plugin.Property;
|
||||
import com.avaje.ebean.text.StringParser;
|
||||
import com.avaje.ebeaninternal.api.SpiExpressionRequest;
|
||||
@@ -972,7 +972,7 @@ public class BeanProperty implements ElPropertyValue, Property {
|
||||
/**
|
||||
* Return the DB column type definition.
|
||||
*/
|
||||
public String renderDbType(DbType dbType, boolean strict) {
|
||||
public String renderDbType(DbPlatformType dbType, boolean strict) {
|
||||
if (dbColumnDefn != null) {
|
||||
return dbColumnDefn;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.avaje.ebean.config.NamingConvention;
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebean.config.TableName;
|
||||
import com.avaje.ebean.config.dbplatform.DatabasePlatform;
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformType;
|
||||
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanProperty;
|
||||
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanPropertyCompound;
|
||||
import com.avaje.ebeaninternal.server.type.DataEncryptSupport;
|
||||
@@ -254,7 +254,7 @@ public class DeployUtil {
|
||||
}
|
||||
|
||||
public void setDbJsonBType(DeployBeanProperty prop, DbJsonB dbJsonB) {
|
||||
setDbJsonType(prop, DbType.JSONB, dbJsonB.length());
|
||||
setDbJsonType(prop, DbPlatformType.JSONB, dbJsonB.length());
|
||||
}
|
||||
|
||||
private void setDbJsonType(DeployBeanProperty prop, int dbType, int dbLength) {
|
||||
@@ -280,9 +280,9 @@ public class DeployUtil {
|
||||
|
||||
switch (dbJsonType) {
|
||||
case JSON:
|
||||
return DbType.JSON;
|
||||
return DbPlatformType.JSON;
|
||||
case JSONB:
|
||||
return DbType.JSONB;
|
||||
return DbPlatformType.JSONB;
|
||||
case VARCHAR:
|
||||
return Types.VARCHAR;
|
||||
case CLOB:
|
||||
@@ -290,7 +290,7 @@ public class DeployUtil {
|
||||
case BLOB:
|
||||
return Types.BLOB;
|
||||
default:
|
||||
return DbType.JSON;
|
||||
return DbPlatformType.JSON;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformType;
|
||||
import com.avaje.ebeaninternal.api.BindParams;
|
||||
import com.avaje.ebeaninternal.server.core.DbExpressionHandler;
|
||||
import com.avaje.ebeaninternal.server.core.Message;
|
||||
@@ -321,7 +321,7 @@ public class Binder {
|
||||
b.setBytes((byte[]) data);
|
||||
break;
|
||||
|
||||
case DbType.UUID:
|
||||
case DbPlatformType.UUID:
|
||||
// native UUID support in H2 and Postgres
|
||||
b.setObject(data);
|
||||
break;
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.avaje.ebean.config.JsonConfig;
|
||||
import com.avaje.ebean.config.ScalarTypeConverter;
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebean.config.dbplatform.DatabasePlatform;
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformType;
|
||||
import com.avaje.ebean.dbmigration.DbOffline;
|
||||
import com.avaje.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import com.avaje.ebeaninternal.server.type.reflect.CheckImmutable;
|
||||
@@ -421,9 +421,9 @@ public final class DefaultTypeManager implements TypeManager, KnownImmutable {
|
||||
return jsonNodeBlob;
|
||||
case Types.CLOB:
|
||||
return jsonNodeClob;
|
||||
case DbType.JSONB:
|
||||
case DbPlatformType.JSONB:
|
||||
return jsonNodeJsonb;
|
||||
case DbType.JSON:
|
||||
case DbPlatformType.JSON:
|
||||
return jsonNodeJson;
|
||||
default:
|
||||
return jsonNodeJson;
|
||||
@@ -939,7 +939,7 @@ public final class DefaultTypeManager implements TypeManager, KnownImmutable {
|
||||
int platformClobType = databasePlatform.getClobDbType();
|
||||
int platformBlobType = databasePlatform.getBlobDbType();
|
||||
|
||||
nativeMap.put(DbType.HSTORE, hstoreType);
|
||||
nativeMap.put(DbPlatformType.HSTORE, hstoreType);
|
||||
|
||||
ScalarType<?> utilDateType = extraTypeFactory.createUtilDate(mode);
|
||||
typeMap.put(java.util.Date.class, utilDateType);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformType;
|
||||
import com.avaje.ebean.text.json.EJson;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
@@ -22,9 +22,9 @@ public class ScalarTypeJsonList {
|
||||
public static ScalarType<?> typeFor(boolean postgres, int dbType, DocPropertyType docType) {
|
||||
if (postgres) {
|
||||
switch (dbType) {
|
||||
case DbType.JSONB:
|
||||
case DbPlatformType.JSONB:
|
||||
return new ScalarTypeJsonList.JsonB(docType);
|
||||
case DbType.JSON:
|
||||
case DbPlatformType.JSON:
|
||||
return new ScalarTypeJsonList.Json(docType);
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class ScalarTypeJsonList {
|
||||
*/
|
||||
private static class Json extends ScalarTypeJsonList.PgBase {
|
||||
public Json(DocPropertyType docType) {
|
||||
super(DbType.JSON, PostgresHelper.JSON_TYPE, docType);
|
||||
super(DbPlatformType.JSON, PostgresHelper.JSON_TYPE, docType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ScalarTypeJsonList {
|
||||
*/
|
||||
private static class JsonB extends ScalarTypeJsonList.PgBase {
|
||||
public JsonB(DocPropertyType docType) {
|
||||
super(DbType.JSONB, PostgresHelper.JSONB_TYPE, docType);
|
||||
super(DbPlatformType.JSONB, PostgresHelper.JSONB_TYPE, docType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.EJson;
|
||||
import com.avaje.ebeaninternal.util.EncodeUtil;
|
||||
@@ -41,9 +41,9 @@ public abstract class ScalarTypeJsonMap extends ScalarTypeBase<Map> {
|
||||
return BLOB;
|
||||
case Types.CLOB:
|
||||
return CLOB;
|
||||
case DbType.JSONB:
|
||||
case DbPlatformType.JSONB:
|
||||
return postgres ? JSONB : CLOB;
|
||||
case DbType.JSON:
|
||||
case DbPlatformType.JSON:
|
||||
return postgres ? JSON : CLOB;
|
||||
default:
|
||||
throw new IllegalStateException("Unknown dbType " + dbType);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformType;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
@@ -30,7 +30,7 @@ public abstract class ScalarTypeJsonMapPostgres extends ScalarTypeJsonMap {
|
||||
public static class JSON extends ScalarTypeJsonMapPostgres {
|
||||
|
||||
public JSON() {
|
||||
super(DbType.JSON, PostgresHelper.JSON_TYPE);
|
||||
super(DbPlatformType.JSON, PostgresHelper.JSON_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public abstract class ScalarTypeJsonMapPostgres extends ScalarTypeJsonMap {
|
||||
public static class JSONB extends ScalarTypeJsonMapPostgres {
|
||||
|
||||
public JSONB() {
|
||||
super(DbType.JSONB, PostgresHelper.JSONB_TYPE);
|
||||
super(DbPlatformType.JSONB, PostgresHelper.JSONB_TYPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformType;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
@@ -33,7 +33,7 @@ public abstract class ScalarTypeJsonNodePostgres extends ScalarTypeJsonNode {
|
||||
public static class JSON extends ScalarTypeJsonNodePostgres {
|
||||
|
||||
public JSON(ObjectMapper objectMapper) {
|
||||
super(objectMapper, DbType.JSON, PostgresHelper.JSON_TYPE);
|
||||
super(objectMapper, DbPlatformType.JSON, PostgresHelper.JSON_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public abstract class ScalarTypeJsonNodePostgres extends ScalarTypeJsonNode {
|
||||
public static class JSONB extends ScalarTypeJsonNodePostgres {
|
||||
|
||||
public JSONB(ObjectMapper objectMapper) {
|
||||
super(objectMapper, DbType.JSONB, PostgresHelper.JSONB_TYPE);
|
||||
super(objectMapper, DbPlatformType.JSONB, PostgresHelper.JSONB_TYPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformType;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
@@ -45,9 +45,9 @@ public class ScalarTypeJsonObjectMapper {
|
||||
private static String getPostgresType(boolean postgres, int dbType) {
|
||||
if (postgres) {
|
||||
switch (dbType) {
|
||||
case DbType.JSON:
|
||||
case DbPlatformType.JSON:
|
||||
return PostgresHelper.JSON_TYPE;
|
||||
case DbType.JSONB:
|
||||
case DbPlatformType.JSONB:
|
||||
return PostgresHelper.JSONB_TYPE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformType;
|
||||
import com.avaje.ebean.text.json.EJson;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
@@ -25,9 +25,9 @@ public class ScalarTypeJsonSet {
|
||||
public static ScalarType<?> typeFor(boolean postgres, int dbType, DocPropertyType docPropertyType) {
|
||||
if (postgres) {
|
||||
switch (dbType) {
|
||||
case DbType.JSONB:
|
||||
case DbPlatformType.JSONB:
|
||||
return new ScalarTypeJsonSet.JsonB(docPropertyType);
|
||||
case DbType.JSON:
|
||||
case DbPlatformType.JSON:
|
||||
return new ScalarTypeJsonSet.Json(docPropertyType);
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class ScalarTypeJsonSet {
|
||||
*/
|
||||
private static class Json extends ScalarTypeJsonSet.PgBase {
|
||||
public Json(DocPropertyType docPropertyType) {
|
||||
super(DbType.JSON, PostgresHelper.JSON_TYPE, docPropertyType);
|
||||
super(DbPlatformType.JSON, PostgresHelper.JSON_TYPE, docPropertyType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ScalarTypeJsonSet {
|
||||
*/
|
||||
private static class JsonB extends ScalarTypeJsonSet.PgBase {
|
||||
public JsonB(DocPropertyType docPropertyType) {
|
||||
super(DbType.JSONB, PostgresHelper.JSONB_TYPE, docPropertyType);
|
||||
super(DbPlatformType.JSONB, PostgresHelper.JSONB_TYPE, docPropertyType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.EJson;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
@@ -20,7 +20,7 @@ import java.util.Map;
|
||||
public class ScalarTypePostgresHstore extends ScalarTypeBase<Map> {
|
||||
|
||||
public ScalarTypePostgresHstore() {
|
||||
super(Map.class, false, DbType.HSTORE);
|
||||
super(Map.class, false, DbPlatformType.HSTORE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformType;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
@@ -22,7 +22,7 @@ public abstract class ScalarTypeUUIDBase extends ScalarTypeBase<UUID> implements
|
||||
|
||||
@Override
|
||||
public int getLogicalType() {
|
||||
return DbType.UUID;
|
||||
return DbPlatformType.UUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformType;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
@@ -11,7 +11,7 @@ import java.util.UUID;
|
||||
public class ScalarTypeUUIDNative extends ScalarTypeUUIDBase {
|
||||
|
||||
public ScalarTypeUUIDNative() {
|
||||
super(false, DbType.UUID);
|
||||
super(false, DbPlatformType.UUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user