mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-22 15:10:02 +00:00
Refactor ScalarType methods from getters to accessors
This commit is contained in:
1 parent
4959053ce0
commit
26f0605d72
78 files changed
+167
-167
No files matched your search
@@ -34,7 +34,7 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
|||||||
/**
|
/**
|
||||||
* Return true for types that do mutation detection based on json content.
|
* Return true for types that do mutation detection based on json content.
|
||||||
*/
|
*/
|
||||||
default boolean isJsonMapper() {
|
default boolean jsonMapper() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,14 +42,14 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
|||||||
* Return true if this is a binary type and can not support parse() and format() from/to string.
|
* Return true if this is a binary type and can not support parse() and format() from/to string.
|
||||||
* This allows Ebean to optimise marshalling types to string.
|
* This allows Ebean to optimise marshalling types to string.
|
||||||
*/
|
*/
|
||||||
default boolean isBinaryType() {
|
default boolean binary() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if this is a mutable scalar type (like hstore).
|
* Return true if this is a mutable scalar type (like hstore).
|
||||||
*/
|
*/
|
||||||
default boolean isMutable() {
|
default boolean mutable() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
|||||||
* If a BeanProperty has no explicit length defined then this length should
|
* If a BeanProperty has no explicit length defined then this length should
|
||||||
* be assigned.
|
* be assigned.
|
||||||
*/
|
*/
|
||||||
default int getLength() {
|
default int length() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
|||||||
* If it is native to JDBC then its values/instances do not need to be
|
* If it is native to JDBC then its values/instances do not need to be
|
||||||
* converted to and from an associated JDBC type.
|
* converted to and from an associated JDBC type.
|
||||||
*/
|
*/
|
||||||
boolean isJdbcNative();
|
boolean jdbcNative();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type as per java.sql.Types that this maps to.
|
* Return the type as per java.sql.Types that this maps to.
|
||||||
@@ -85,14 +85,14 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
|||||||
* This type should be consistent with the toJdbcType() method in converting
|
* This type should be consistent with the toJdbcType() method in converting
|
||||||
* the type to the appropriate type for binding to preparedStatements.
|
* the type to the appropriate type for binding to preparedStatements.
|
||||||
*/
|
*/
|
||||||
int getJdbcType();
|
int jdbcType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type that matches the bean property type.
|
* Return the type that matches the bean property type.
|
||||||
* <p>
|
* <p>
|
||||||
* This represents the 'logical' type rather than the JDBC type this maps to.
|
* This represents the 'logical' type rather than the JDBC type this maps to.
|
||||||
*/
|
*/
|
||||||
Class<T> getType();
|
Class<T> type();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the value from the resultSet and convert if necessary to the logical
|
* Read the value from the resultSet and convert if necessary to the logical
|
||||||
@@ -161,7 +161,7 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
|||||||
/**
|
/**
|
||||||
* Return the type this maps to for JSON document stores.
|
* Return the type this maps to for JSON document stores.
|
||||||
*/
|
*/
|
||||||
DocPropertyType getDocType();
|
DocPropertyType docType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the value into a long version value.
|
* Convert the value into a long version value.
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ class BeanDescriptorElementEmbeddedMap<T> extends BeanDescriptorElementEmbedded<
|
|||||||
BeanDescriptorElementEmbeddedMap(BeanDescriptorMap owner, DeployBeanDescriptor<T> deploy, ElementHelp elementHelp) {
|
BeanDescriptorElementEmbeddedMap(BeanDescriptorMap owner, DeployBeanDescriptor<T> deploy, ElementHelp elementHelp) {
|
||||||
super(owner, deploy, elementHelp);
|
super(owner, deploy, elementHelp);
|
||||||
this.scalarTypeKey = firstBaseScalarType();
|
this.scalarTypeKey = firstBaseScalarType();
|
||||||
this.stringKey = String.class.equals(scalarTypeKey.getType());
|
this.stringKey = String.class.equals(scalarTypeKey.type());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ class BeanDescriptorElementScalarMap<T> extends BeanDescriptorElement<T> {
|
|||||||
}
|
}
|
||||||
this.scalarTypeKey = props[0].scalarType();
|
this.scalarTypeKey = props[0].scalarType();
|
||||||
this.scalarTypeVal = props[1].scalarType();
|
this.scalarTypeVal = props[1].scalarType();
|
||||||
this.stringKey = String.class.equals(scalarTypeKey.getType());
|
this.stringKey = String.class.equals(scalarTypeKey.type());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
|||||||
* Return true if the underlying type is mutable.
|
* Return true if the underlying type is mutable.
|
||||||
*/
|
*/
|
||||||
public boolean isMutableScalarType() {
|
public boolean isMutableScalarType() {
|
||||||
return scalarType != null && scalarType.isMutable();
|
return scalarType != null && scalarType.mutable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -703,7 +703,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Object cacheDataConvert(Object value) {
|
private Object cacheDataConvert(Object value) {
|
||||||
if (value == null || scalarType.isBinaryType()) {
|
if (value == null || scalarType.binary()) {
|
||||||
return value;
|
return value;
|
||||||
} else {
|
} else {
|
||||||
// convert to string as an optimisation for java object serialisation
|
// convert to string as an optimisation for java object serialisation
|
||||||
@@ -942,7 +942,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int jdbcType() {
|
public int jdbcType() {
|
||||||
return scalarType == null ? 0 : scalarType.getJdbcType();
|
return scalarType == null ? 0 : scalarType.jdbcType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1467,7 +1467,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
|||||||
*/
|
*/
|
||||||
public void docStoreMapping(DocMappingBuilder mapping, String prefix) {
|
public void docStoreMapping(DocMappingBuilder mapping, String prefix) {
|
||||||
if (mapping.includesProperty(prefix, name)) {
|
if (mapping.includesProperty(prefix, name)) {
|
||||||
DocPropertyType type = scalarType.getDocType();
|
DocPropertyType type = scalarType.docType();
|
||||||
DocPropertyOptions options = docOptions.copy();
|
DocPropertyOptions options = docOptions.copy();
|
||||||
if (isKeywordType(type, options)) {
|
if (isKeywordType(type, options)) {
|
||||||
type = DocPropertyType.KEYWORD;
|
type = DocPropertyType.KEYWORD;
|
||||||
|
|||||||
+3
-3
@@ -175,7 +175,7 @@ public class DeployBeanProperty {
|
|||||||
this.propertyType = propertyType;
|
this.propertyType = propertyType;
|
||||||
this.genericType = null;
|
this.genericType = null;
|
||||||
this.scalarType = wrapScalarType(propertyType, scalarType, typeConverter);
|
this.scalarType = wrapScalarType(propertyType, scalarType, typeConverter);
|
||||||
this.dbType = (scalarType == null) ? 0 : scalarType.getJdbcType();
|
this.dbType = (scalarType == null) ? 0 : scalarType.jdbcType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeployBeanProperty(DeployBeanDescriptor<?> desc, Class<?> propertyType, Type genericType) {
|
public DeployBeanProperty(DeployBeanDescriptor<?> desc, Class<?> propertyType, Type genericType) {
|
||||||
@@ -240,7 +240,7 @@ public class DeployBeanProperty {
|
|||||||
*/
|
*/
|
||||||
public int getDbLength() {
|
public int getDbLength() {
|
||||||
if (dbLength == 0 && scalarType != null) {
|
if (dbLength == 0 && scalarType != null) {
|
||||||
return scalarType.getLength();
|
return scalarType.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
return dbLength;
|
return dbLength;
|
||||||
@@ -1145,7 +1145,7 @@ public class DeployBeanProperty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean isJsonMapper() {
|
boolean isJsonMapper() {
|
||||||
return scalarType != null && scalarType.isJsonMapper();
|
return scalarType != null && scalarType.jsonMapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isJsonType() {
|
boolean isJsonType() {
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ final class AnnotationFields extends AnnotationParser {
|
|||||||
private void setEncryption(DeployBeanProperty prop, boolean dbEncString, int dbLen) {
|
private void setEncryption(DeployBeanProperty prop, boolean dbEncString, int dbLen) {
|
||||||
util.checkEncryptKeyManagerDefined(prop.getFullBeanName());
|
util.checkEncryptKeyManagerDefined(prop.getFullBeanName());
|
||||||
ScalarType<?> st = prop.getScalarType();
|
ScalarType<?> st = prop.getScalarType();
|
||||||
if (byte[].class.equals(st.getType())) {
|
if (byte[].class.equals(st.type())) {
|
||||||
// Always using Java client encryption rather than DB for encryption
|
// Always using Java client encryption rather than DB for encryption
|
||||||
// of binary data (partially as this is not supported on all db's etc)
|
// of binary data (partially as this is not supported on all db's etc)
|
||||||
// This could be reviewed at a later stage.
|
// This could be reviewed at a later stage.
|
||||||
@@ -401,7 +401,7 @@ final class AnnotationFields extends AnnotationParser {
|
|||||||
DbEncrypt dbEncrypt = util.getDbPlatform().dbEncrypt();
|
DbEncrypt dbEncrypt = util.getDbPlatform().dbEncrypt();
|
||||||
if (dbEncrypt != null) {
|
if (dbEncrypt != null) {
|
||||||
// check if we have a DB encryption function for this type
|
// check if we have a DB encryption function for this type
|
||||||
int jdbcType = prop.getScalarType().getJdbcType();
|
int jdbcType = prop.getScalarType().jdbcType();
|
||||||
DbEncryptFunction dbEncryptFunction = dbEncrypt.getDbEncryptFunction(jdbcType);
|
DbEncryptFunction dbEncryptFunction = dbEncrypt.getDbEncryptFunction(jdbcType);
|
||||||
if (dbEncryptFunction != null) {
|
if (dbEncryptFunction != null) {
|
||||||
// Use DB functions to encrypt and decrypt
|
// Use DB functions to encrypt and decrypt
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public final class DeployUtil {
|
|||||||
EnumType type = enumerated != null ? enumerated.value() : null;
|
EnumType type = enumerated != null ? enumerated.value() : null;
|
||||||
ScalarType<?> scalarType = typeManager.createEnumScalarType(enumClass, type);
|
ScalarType<?> scalarType = typeManager.createEnumScalarType(enumClass, type);
|
||||||
prop.setScalarType(scalarType);
|
prop.setScalarType(scalarType);
|
||||||
prop.setDbType(scalarType.getJdbcType());
|
prop.setDbType(scalarType.jdbcType());
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
throw new PersistenceException("Error mapping property " + prop.getFullBeanName() + " - " + e.getMessage());
|
throw new PersistenceException("Error mapping property " + prop.getFullBeanName() + " - " + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -126,7 +126,7 @@ public final class DeployUtil {
|
|||||||
ScalarType<?> scalarType = getScalarType(property);
|
ScalarType<?> scalarType = getScalarType(property);
|
||||||
if (scalarType != null) {
|
if (scalarType != null) {
|
||||||
// set the jdbc type this maps to
|
// set the jdbc type this maps to
|
||||||
property.setDbType(scalarType.getJdbcType());
|
property.setDbType(scalarType.jdbcType());
|
||||||
property.setScalarType(scalarType);
|
property.setScalarType(scalarType);
|
||||||
property.checkPrimitiveBoolean();
|
property.checkPrimitiveBoolean();
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ public final class DeployUtil {
|
|||||||
*/
|
*/
|
||||||
void setDbMap(DeployBeanProperty prop, DbMap dbMap) {
|
void setDbMap(DeployBeanProperty prop, DbMap dbMap) {
|
||||||
ScalarType<?> scalarType = typeManager.getDbMapScalarType();
|
ScalarType<?> scalarType = typeManager.getDbMapScalarType();
|
||||||
int dbType = scalarType.getJdbcType();
|
int dbType = scalarType.jdbcType();
|
||||||
prop.setDbType(dbType);
|
prop.setDbType(dbType);
|
||||||
prop.setScalarType(scalarType);
|
prop.setScalarType(scalarType);
|
||||||
if (dbType == Types.VARCHAR) {
|
if (dbType == Types.VARCHAR) {
|
||||||
@@ -176,7 +176,7 @@ public final class DeployUtil {
|
|||||||
if (scalarType == null) {
|
if (scalarType == null) {
|
||||||
throw new RuntimeException("No ScalarType for @DbArray type for [" + prop.getFullBeanName() + "]");
|
throw new RuntimeException("No ScalarType for @DbArray type for [" + prop.getFullBeanName() + "]");
|
||||||
}
|
}
|
||||||
int dbType = scalarType.getJdbcType();
|
int dbType = scalarType.jdbcType();
|
||||||
prop.setDbType(dbType);
|
prop.setDbType(dbType);
|
||||||
prop.setScalarType(scalarType);
|
prop.setScalarType(scalarType);
|
||||||
if (scalarType instanceof ScalarTypeArray) {
|
if (scalarType instanceof ScalarTypeArray) {
|
||||||
@@ -240,7 +240,7 @@ public final class DeployUtil {
|
|||||||
void setLobType(DeployBeanProperty prop) {
|
void setLobType(DeployBeanProperty prop) {
|
||||||
ScalarType<?> scalarType = prop.getScalarType();
|
ScalarType<?> scalarType = prop.getScalarType();
|
||||||
if (scalarType instanceof ScalarTypeWrapper) {
|
if (scalarType instanceof ScalarTypeWrapper) {
|
||||||
int lobType = scalarType.getJdbcType() == Types.VARCHAR ? dbCLOBType : dbBLOBType;
|
int lobType = scalarType.jdbcType() == Types.VARCHAR ? dbCLOBType : dbBLOBType;
|
||||||
prop.setDbType(lobType);
|
prop.setDbType(lobType);
|
||||||
} else {
|
} else {
|
||||||
// is String or byte[] ? used to determine if its a CLOB or BLOB
|
// is String or byte[] ? used to determine if its a CLOB or BLOB
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ public final class ElPropertyChain implements ElPropertyValue {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int jdbcType() {
|
public int jdbcType() {
|
||||||
return scalarType == null ? 0 : scalarType.getJdbcType();
|
return scalarType == null ? 0 : scalarType.jdbcType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ public final class Binder {
|
|||||||
public boolean isMultiValueSupported(Class<?> cls) {
|
public boolean isMultiValueSupported(Class<?> cls) {
|
||||||
try {
|
try {
|
||||||
ScalarType<?> scalarType = getScalarType(cls);
|
ScalarType<?> scalarType = getScalarType(cls);
|
||||||
return multiValueBind.isTypeSupported(scalarType.getJdbcType());
|
return multiValueBind.isTypeSupported(scalarType.jdbcType());
|
||||||
} catch (PersistenceException e) {
|
} catch (PersistenceException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -173,18 +173,18 @@ public final class Binder {
|
|||||||
Collection<?> values = wrapper.getValues();
|
Collection<?> values = wrapper.getValues();
|
||||||
|
|
||||||
ScalarType<?> type = getScalarType(wrapper.getType());
|
ScalarType<?> type = getScalarType(wrapper.getType());
|
||||||
int dbType = type.getJdbcType();
|
int dbType = type.jdbcType();
|
||||||
// let the multiValueBind decide what to do with the value
|
// let the multiValueBind decide what to do with the value
|
||||||
multiValueBind.bindMultiValues(dataBind, values, type, one -> bindObject(dataBind, one, dbType));
|
multiValueBind.bindMultiValues(dataBind, values, type, one -> bindObject(dataBind, one, dbType));
|
||||||
return values;
|
return values;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ScalarType<?> type = getScalarType(value.getClass());
|
ScalarType<?> type = getScalarType(value.getClass());
|
||||||
if (!type.isJdbcNative()) {
|
if (!type.jdbcNative()) {
|
||||||
// convert to a JDBC native type
|
// convert to a JDBC native type
|
||||||
value = type.toJdbcType(value);
|
value = type.toJdbcType(value);
|
||||||
}
|
}
|
||||||
bindObject(dataBind, value, type.getJdbcType());
|
bindObject(dataBind, value, type.jdbcType());
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ abstract class AbstractMultiValueBind extends MultiValueBind {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindMultiValues(DataBind dataBind, Collection<?> values, ScalarType<?> type, BindOne bindOne) throws SQLException {
|
public void bindMultiValues(DataBind dataBind, Collection<?> values, ScalarType<?> type, BindOne bindOne) throws SQLException {
|
||||||
String arrayType = getArrayType(type.getJdbcType());
|
String arrayType = getArrayType(type.jdbcType());
|
||||||
if (arrayType == null) {
|
if (arrayType == null) {
|
||||||
super.bindMultiValues(dataBind, values, type, bindOne);
|
super.bindMultiValues(dataBind, values, type, bindOne);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ public class MultiValueBind {
|
|||||||
*/
|
*/
|
||||||
public void bindMultiValues(DataBind dataBind, Collection<?> values, ScalarType<?> type, BindOne bindOne) throws SQLException {
|
public void bindMultiValues(DataBind dataBind, Collection<?> values, ScalarType<?> type, BindOne bindOne) throws SQLException {
|
||||||
for (Object value : values) {
|
for (Object value : values) {
|
||||||
if (!type.isJdbcNative()) {
|
if (!type.jdbcNative()) {
|
||||||
value = type.toJdbcType(value);
|
value = type.toJdbcType(value);
|
||||||
}
|
}
|
||||||
bindOne.bind(value);
|
bindOne.bind(value);
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ public final class PostgresMultiValueBind extends AbstractMultiValueBind {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInExpression(boolean not, ScalarType<?> type, int size) {
|
public String getInExpression(boolean not, ScalarType<?> type, int size) {
|
||||||
int dbType = type.getJdbcType();
|
int dbType = type.jdbcType();
|
||||||
if (dbType == ExtraDbTypes.UUID) {
|
if (dbType == ExtraDbTypes.UUID) {
|
||||||
return (not) ? " != all(?::uuid[])" : " = any(?::uuid[])";
|
return (not) ? " != all(?::uuid[])" : " = any(?::uuid[])";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,14 +215,14 @@ public final class DefaultTypeManager implements TypeManager {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void add(ScalarType<?> scalarType) {
|
public void add(ScalarType<?> scalarType) {
|
||||||
typeMap.put(scalarType.getType(), scalarType);
|
typeMap.put(scalarType.type(), scalarType);
|
||||||
logAdd(scalarType);
|
logAdd(scalarType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logAdd(ScalarType<?> scalarType) {
|
private void logAdd(ScalarType<?> scalarType) {
|
||||||
if (log.isLoggable(TRACE)) {
|
if (log.isLoggable(TRACE)) {
|
||||||
String msg = "ScalarType register [" + scalarType.getClass().getName() + "]";
|
String msg = "ScalarType register [" + scalarType.getClass().getName() + "]";
|
||||||
msg += " for [" + scalarType.getType().getName() + "]";
|
msg += " for [" + scalarType.type().getName() + "]";
|
||||||
log.log(TRACE, msg);
|
log.log(TRACE, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -410,7 +410,7 @@ public final class DefaultTypeManager implements TypeManager {
|
|||||||
if (genericType instanceof Class<?>) {
|
if (genericType instanceof Class<?>) {
|
||||||
ScalarType<?> found = getScalarType((Class<?>)genericType);
|
ScalarType<?> found = getScalarType((Class<?>)genericType);
|
||||||
if (found != null) {
|
if (found != null) {
|
||||||
return found.getDocType();
|
return found.docType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return DocPropertyType.OBJECT;
|
return DocPropertyType.OBJECT;
|
||||||
@@ -468,7 +468,7 @@ public final class DefaultTypeManager implements TypeManager {
|
|||||||
|
|
||||||
scalarType = getScalarType(type);
|
scalarType = getScalarType(type);
|
||||||
if (scalarType != null) {
|
if (scalarType != null) {
|
||||||
if (jdbcType == 0 || scalarType.getJdbcType() == jdbcType) {
|
if (jdbcType == 0 || scalarType.jdbcType() == jdbcType) {
|
||||||
// matching type
|
// matching type
|
||||||
return scalarType;
|
return scalarType;
|
||||||
}
|
}
|
||||||
@@ -851,7 +851,7 @@ public final class DefaultTypeManager implements TypeManager {
|
|||||||
databasePlatform.setDbFalseLiteral(booleanType.getDbFalseLiteral());
|
databasePlatform.setDbFalseLiteral(booleanType.getDbFalseLiteral());
|
||||||
// always register Types.BOOLEAN to our boolean type
|
// always register Types.BOOLEAN to our boolean type
|
||||||
nativeMap.put(Types.BOOLEAN, booleanType);
|
nativeMap.put(Types.BOOLEAN, booleanType);
|
||||||
if (booleanType.getJdbcType() == Types.BIT) {
|
if (booleanType.jdbcType() == Types.BIT) {
|
||||||
// for MapBeans ... BIT types are assumed to be booleans
|
// for MapBeans ... BIT types are assumed to be booleans
|
||||||
nativeMap.put(Types.BIT, booleanType);
|
nativeMap.put(Types.BIT, booleanType);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -36,6 +36,6 @@ class PlatformArrayTypeJsonList implements PlatformArrayTypeFactory {
|
|||||||
@Override
|
@Override
|
||||||
public ScalarType<?> typeForEnum(ScalarType<?> scalarType, boolean nullable) {
|
public ScalarType<?> typeForEnum(ScalarType<?> scalarType, boolean nullable) {
|
||||||
final ArrayElementConverter.EnumConverter converter = new ArrayElementConverter.EnumConverter(scalarType);
|
final ArrayElementConverter.EnumConverter converter = new ArrayElementConverter.EnumConverter(scalarType);
|
||||||
return new ScalarTypeJsonList.VarcharWithConverter(scalarType.getDocType(), nullable, false, converter);
|
return new ScalarTypeJsonList.VarcharWithConverter(scalarType.docType(), nullable, false, converter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,6 +36,6 @@ class PlatformArrayTypeJsonSet implements PlatformArrayTypeFactory {
|
|||||||
@Override
|
@Override
|
||||||
public ScalarType<?> typeForEnum(ScalarType<?> scalarType, boolean nullable) {
|
public ScalarType<?> typeForEnum(ScalarType<?> scalarType, boolean nullable) {
|
||||||
final ArrayElementConverter.EnumConverter converter = new ArrayElementConverter.EnumConverter(scalarType);
|
final ArrayElementConverter.EnumConverter converter = new ArrayElementConverter.EnumConverter(scalarType);
|
||||||
return new ScalarTypeJsonSet.VarcharWithConverter(scalarType.getDocType(), nullable, false, converter);
|
return new ScalarTypeJsonSet.VarcharWithConverter(scalarType.docType(), nullable, false, converter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,13 +71,13 @@ abstract class ScalarTypeArrayBase<T> extends ScalarTypeJsonCollection<T> {
|
|||||||
protected abstract T fromArray(Object[] array1);
|
protected abstract T fromArray(Object[] array1);
|
||||||
|
|
||||||
static String arrayTypeFor(ScalarType<?> scalarType) {
|
static String arrayTypeFor(ScalarType<?> scalarType) {
|
||||||
switch (scalarType.getJdbcType()) {
|
switch (scalarType.jdbcType()) {
|
||||||
case Types.INTEGER:
|
case Types.INTEGER:
|
||||||
return "integer";
|
return "integer";
|
||||||
case Types.VARCHAR:
|
case Types.VARCHAR:
|
||||||
return "varchar";
|
return "varchar";
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("JdbcType [" + scalarType.getJdbcType() + "] not supported for @DbArray mapping on set.");
|
throw new IllegalArgumentException("JdbcType [" + scalarType.jdbcType() + "] not supported for @DbArray mapping on set.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ class ScalarTypeArrayList extends ScalarTypeArrayBase<List> implements ScalarTyp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScalarTypeArrayList typeForEnum(ScalarType<?> scalarType, boolean nullable) {
|
public ScalarTypeArrayList typeForEnum(ScalarType<?> scalarType, boolean nullable) {
|
||||||
return new ScalarTypeArrayList(nullable, arrayTypeFor(scalarType), scalarType.getDocType(), new ArrayElementConverter.EnumConverter(scalarType));
|
return new ScalarTypeArrayList(nullable, arrayTypeFor(scalarType), scalarType.docType(), new ArrayElementConverter.EnumConverter(scalarType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ class ScalarTypeArrayList extends ScalarTypeArrayBase<List> implements ScalarTyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return docPropertyType;
|
return docPropertyType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class ScalarTypeArraySet extends ScalarTypeArrayBase<Set> implements ScalarTypeA
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScalarType<?> typeForEnum(ScalarType<?> scalarType, boolean nullable) {
|
public ScalarType<?> typeForEnum(ScalarType<?> scalarType, boolean nullable) {
|
||||||
return new ScalarTypeArraySet(nullable, arrayTypeFor(scalarType), scalarType.getDocType(), new ArrayElementConverter.EnumConverter(scalarType));
|
return new ScalarTypeArraySet(nullable, arrayTypeFor(scalarType), scalarType.docType(), new ArrayElementConverter.EnumConverter(scalarType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ class ScalarTypeArraySet extends ScalarTypeArrayBase<Set> implements ScalarTypeA
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return docPropertyType;
|
return docPropertyType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,17 +19,17 @@ abstract class ScalarTypeBase<T> implements ScalarType<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isJdbcNative() {
|
public boolean jdbcNative() {
|
||||||
return jdbcNative;
|
return jdbcNative;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getJdbcType() {
|
public int jdbcType() {
|
||||||
return jdbcType;
|
return jdbcType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<T> getType() {
|
public Class<T> type() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ abstract class ScalarTypeBaseDate<T> extends ScalarTypeBase<T> {
|
|||||||
protected abstract String toIsoFormat(T value);
|
protected abstract String toIsoFormat(T value);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.DATE;
|
return DocPropertyType.DATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ abstract class ScalarTypeBaseDateTime<T> extends ScalarTypeBase<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.DATETIME;
|
return DocPropertyType.DATETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ abstract class ScalarTypeBaseVarchar<T> extends ScalarTypeBase<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.TEXT;
|
return DocPropertyType.TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class ScalarTypeBigDecimal extends ScalarTypeBase<BigDecimal> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.DOUBLE;
|
return DocPropertyType.DOUBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ public final class ScalarTypeBoolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ public final class ScalarTypeBoolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return Math.max(trueValue.length(), falseValue.length());
|
return Math.max(trueValue.length(), falseValue.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ public final class ScalarTypeBoolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.BOOLEAN;
|
return DocPropertyType.BOOLEAN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ final class ScalarTypeByte extends ScalarTypeBase<Byte> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBinaryType() {
|
public boolean binary() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ final class ScalarTypeByte extends ScalarTypeBase<Byte> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.BINARY;
|
return DocPropertyType.BINARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public abstract class ScalarTypeBytesBase extends ScalarTypeBase<byte[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBinaryType() {
|
public boolean binary() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ public abstract class ScalarTypeBytesBase extends ScalarTypeBase<byte[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.BINARY;
|
return DocPropertyType.BINARY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-10
@@ -27,7 +27,7 @@ public final class ScalarTypeBytesEncrypted implements ScalarType<byte[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBinaryType() {
|
public boolean binary() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,23 +38,23 @@ public final class ScalarTypeBytesEncrypted implements ScalarType<byte[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getJdbcType() {
|
public int jdbcType() {
|
||||||
return baseType.getJdbcType();
|
return baseType.jdbcType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return baseType.getLength();
|
return baseType.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<byte[]> getType() {
|
public Class<byte[]> type() {
|
||||||
return byte[].class;
|
return byte[].class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isJdbcNative() {
|
public boolean jdbcNative() {
|
||||||
return baseType.isJdbcNative();
|
return baseType.jdbcNative();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -75,8 +75,8 @@ public final class ScalarTypeBytesEncrypted implements ScalarType<byte[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return baseType.getDocType();
|
return baseType.docType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ final class ScalarTypeClass extends ScalarTypeBaseVarchar<Class> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ final class ScalarTypeCurrency extends ScalarTypeBaseVarchar<Currency> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ final class ScalarTypeDouble extends ScalarTypeBase<Double> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.DOUBLE;
|
return DocPropertyType.DOUBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class ScalarTypeDuration extends ScalarTypeBase<Duration> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.KEYWORD;
|
return DocPropertyType.KEYWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-13
@@ -31,13 +31,13 @@ public final class ScalarTypeEncryptedWrapper<T> implements ScalarType<T>, Local
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBinaryType() {
|
public boolean binary() {
|
||||||
return wrapped.isBinaryType();
|
return wrapped.binary();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMutable() {
|
public boolean mutable() {
|
||||||
return wrapped.isMutable();
|
return wrapped.mutable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -80,22 +80,22 @@ public final class ScalarTypeEncryptedWrapper<T> implements ScalarType<T>, Local
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getJdbcType() {
|
public int jdbcType() {
|
||||||
return byteArrayType.getJdbcType();
|
return byteArrayType.jdbcType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return byteArrayType.getLength();
|
return byteArrayType.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<T> getType() {
|
public Class<T> type() {
|
||||||
return wrapped.getType();
|
return wrapped.type();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isJdbcNative() {
|
public boolean jdbcNative() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,8 +146,8 @@ public final class ScalarTypeEncryptedWrapper<T> implements ScalarType<T>, Local
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return wrapped.getDocType();
|
return wrapped.docType();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ final class ScalarTypeEnumStandard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,7 +248,7 @@ final class ScalarTypeEnumStandard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.ENUM;
|
return DocPropertyType.ENUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ class ScalarTypeEnumWithMapping extends ScalarTypeEnumStandard.EnumBase implemen
|
|||||||
* Return the DB column length for storing the enum value.
|
* Return the DB column length for storing the enum value.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ final class ScalarTypeFile extends ScalarTypeBase<File> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBinaryType() {
|
public boolean binary() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ final class ScalarTypeFile extends ScalarTypeBase<File> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.BINARY;
|
return DocPropertyType.BINARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ final class ScalarTypeFloat extends ScalarTypeBase<Float> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.FLOAT;
|
return DocPropertyType.FLOAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ final class ScalarTypeInetAddress extends ScalarTypeBaseVarchar<InetAddress> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return 50;
|
return 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ final class ScalarTypeInteger extends ScalarTypeBase<Integer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.INTEGER;
|
return DocPropertyType.INTEGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class ScalarTypeJodaLocalTime extends ScalarTypeBase<LocalTime> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.KEYWORD;
|
return DocPropertyType.KEYWORD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ final class ScalarTypeJodaPeriod extends ScalarTypeBaseVarchar<Period> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return 50;
|
return 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ abstract class ScalarTypeJsonCollection<T> extends ScalarTypeBase<T> implements
|
|||||||
* Consider as a mutable type. Use the isDirty() method to check for dirty state.
|
* Consider as a mutable type. Use the isDirty() method to check for dirty state.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isMutable() {
|
public boolean mutable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ abstract class ScalarTypeJsonCollection<T> extends ScalarTypeBase<T> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return docPropertyType;
|
return docPropertyType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ final class ScalarTypeJsonList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean isJsonMapper() {
|
public final boolean jsonMapper() {
|
||||||
return keepSource;
|
return keepSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ abstract class ScalarTypeJsonMap extends ScalarTypeBase<Map> {
|
|||||||
* Map is a mutable type. Use the isDirty() method to check for dirty state.
|
* Map is a mutable type. Use the isDirty() method to check for dirty state.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final boolean isMutable() {
|
public final boolean mutable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ abstract class ScalarTypeJsonMap extends ScalarTypeBase<Map> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean isJsonMapper() {
|
public final boolean jsonMapper() {
|
||||||
return keepSource;
|
return keepSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ abstract class ScalarTypeJsonMap extends ScalarTypeBase<Map> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final DocPropertyType getDocType() {
|
public final DocPropertyType docType() {
|
||||||
return DocPropertyType.OBJECT;
|
return DocPropertyType.OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ abstract class ScalarTypeJsonNode extends ScalarTypeBase<JsonNode> {
|
|||||||
* Map is a mutable type. Use the isDirty() method to check for dirty state.
|
* Map is a mutable type. Use the isDirty() method to check for dirty state.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isMutable() {
|
public boolean mutable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ abstract class ScalarTypeJsonNode extends ScalarTypeBase<JsonNode> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.OBJECT;
|
return DocPropertyType.OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -70,12 +70,12 @@ final class ScalarTypeJsonObjectMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMutable() {
|
public boolean mutable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isJsonMapper() {
|
public boolean jsonMapper() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ final class ScalarTypeJsonObjectMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final DocPropertyType getDocType() {
|
public final DocPropertyType docType() {
|
||||||
return docType;
|
return docType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ final class ScalarTypeJsonSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean isJsonMapper() {
|
public final boolean jsonMapper() {
|
||||||
return keepSource;
|
return keepSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class ScalarTypeLocalTime extends ScalarTypeBase<LocalTime> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.KEYWORD;
|
return DocPropertyType.KEYWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ final class ScalarTypeLocale extends ScalarTypeBaseVarchar<Locale> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return 20;
|
return 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ final class ScalarTypeLong extends ScalarTypeBase<Long> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.LONG;
|
return DocPropertyType.LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ final class ScalarTypeMathBigInteger extends ScalarTypeBase<BigInteger> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.LONG;
|
return DocPropertyType.LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ final class ScalarTypeMonthDay extends ScalarTypeBase<MonthDay> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.KEYWORD;
|
return DocPropertyType.KEYWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,17 +24,17 @@ class ScalarTypeNotFound implements ScalarType<Void> {
|
|||||||
private ScalarTypeNotFound() { }
|
private ScalarTypeNotFound() { }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isJdbcNative() {
|
public boolean jdbcNative() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getJdbcType() {
|
public int jdbcType() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Void> getType() {
|
public Class<Void> type() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ class ScalarTypeNotFound implements ScalarType<Void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ final class ScalarTypeOffsetTime extends ScalarTypeBaseVarchar<OffsetTime> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return 25;
|
return 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ final class ScalarTypePeriod extends ScalarTypeBaseVarchar<Period> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return 20;
|
return 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ final class ScalarTypePostgresHstore extends ScalarTypeBase<Map> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMutable() {
|
public boolean mutable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ final class ScalarTypePostgresHstore extends ScalarTypeBase<Map> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.OBJECT;
|
return DocPropertyType.OBJECT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ final class ScalarTypeShort extends ScalarTypeBase<Short> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.SHORT;
|
return DocPropertyType.SHORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ abstract class ScalarTypeStringBase extends ScalarTypeBase<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.TEXT;
|
return DocPropertyType.TEXT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ final class ScalarTypeTime extends ScalarTypeBase<Time> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.KEYWORD;
|
return DocPropertyType.KEYWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ final class ScalarTypeTimeZone extends ScalarTypeBaseVarchar<TimeZone> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ abstract class ScalarTypeUUIDBase extends ScalarTypeBase<UUID> implements Scalar
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.UUID;
|
return DocPropertyType.UUID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ public final class ScalarTypeUUIDBinary extends ScalarTypeUUIDBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return 16;
|
return 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ final class ScalarTypeUUIDVarchar extends ScalarTypeUUIDBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return 40;
|
return 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class ScalarTypeWrapper<B, S> implements ScalarType<B> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ScalarTypeWrapper " + wrapperType + " to " + scalarType.getType();
|
return "ScalarTypeWrapper " + wrapperType + " to " + scalarType.type();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -48,13 +48,13 @@ public class ScalarTypeWrapper<B, S> implements ScalarType<B> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBinaryType() {
|
public boolean binary() {
|
||||||
return scalarType.isBinaryType();
|
return scalarType.binary();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMutable() {
|
public boolean mutable() {
|
||||||
return scalarType.isMutable();
|
return scalarType.mutable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -85,22 +85,22 @@ public class ScalarTypeWrapper<B, S> implements ScalarType<B> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getJdbcType() {
|
public int jdbcType() {
|
||||||
return scalarType.getJdbcType();
|
return scalarType.jdbcType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return scalarType.getLength();
|
return scalarType.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<B> getType() {
|
public Class<B> type() {
|
||||||
return wrapperType;
|
return wrapperType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isJdbcNative() {
|
public boolean jdbcNative() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ public class ScalarTypeWrapper<B, S> implements ScalarType<B> {
|
|||||||
if (value == null) {
|
if (value == null) {
|
||||||
return nullValue;
|
return nullValue;
|
||||||
}
|
}
|
||||||
if (getType().isAssignableFrom(value.getClass())) {
|
if (type().isAssignableFrom(value.getClass())) {
|
||||||
return (B) value;
|
return (B) value;
|
||||||
}
|
}
|
||||||
if (value instanceof String) {
|
if (value instanceof String) {
|
||||||
@@ -188,8 +188,8 @@ public class ScalarTypeWrapper<B, S> implements ScalarType<B> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return scalarType.getDocType();
|
return scalarType.docType();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ final class ScalarTypeYear extends ScalarTypeBase<Year> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return DocPropertyType.INTEGER;
|
return DocPropertyType.INTEGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ final class ScalarTypeZoneId extends ScalarTypeBaseVarchar<ZoneId> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return 60;
|
return 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ final class ScalarTypeZoneOffset extends ScalarTypeBaseVarchar<ZoneOffset> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int length() {
|
||||||
return 60;
|
return 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ public class DefaultTypeFactoryTest {
|
|||||||
public void testCreateBoolean() throws Exception {
|
public void testCreateBoolean() throws Exception {
|
||||||
|
|
||||||
ScalarType<Boolean> stIntBoolean = defaultTypeFactory.createBoolean("0", "1");
|
ScalarType<Boolean> stIntBoolean = defaultTypeFactory.createBoolean("0", "1");
|
||||||
assertEquals(Types.INTEGER, stIntBoolean.getJdbcType());
|
assertEquals(Types.INTEGER, stIntBoolean.jdbcType());
|
||||||
|
|
||||||
stIntBoolean = defaultTypeFactory.createBoolean("1", "2");
|
stIntBoolean = defaultTypeFactory.createBoolean("1", "2");
|
||||||
assertEquals(Types.INTEGER, stIntBoolean.getJdbcType());
|
assertEquals(Types.INTEGER, stIntBoolean.jdbcType());
|
||||||
|
|
||||||
ScalarType<Boolean> stStringBoolean = defaultTypeFactory.createBoolean("Y", "N");
|
ScalarType<Boolean> stStringBoolean = defaultTypeFactory.createBoolean("Y", "N");
|
||||||
assertEquals(Types.VARCHAR, stStringBoolean.getJdbcType());
|
assertEquals(Types.VARCHAR, stStringBoolean.jdbcType());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ public class ScalarTypeJodaPeriodTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getLength() {
|
public void getLength() {
|
||||||
assertThat(scalarType.getLength()).isEqualTo(50);
|
assertThat(scalarType.length()).isEqualTo(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class ScalarTypeOffsetTimeTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testGetLength() throws Exception {
|
public void testGetLength() throws Exception {
|
||||||
|
|
||||||
assertEquals(25, type.getLength());
|
assertEquals(25, type.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class ScalarTypePeriodTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getLength() {
|
public void getLength() {
|
||||||
assertThat(scalarType.getLength()).isEqualTo(20);
|
assertThat(scalarType.length()).isEqualTo(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ public class ScalarTypePostgresHstoreTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIsMutable() {
|
public void testIsMutable() {
|
||||||
assertTrue(hstore.isMutable());
|
assertTrue(hstore.mutable());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -10,6 +10,6 @@ class ScalarTypeTimeZoneTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLength() {
|
void getLength() {
|
||||||
assertEquals(32, type.getLength());
|
assertEquals(32, type.length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ public class ScalarTypeZoneIdTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testGetLength() throws Exception {
|
public void testGetLength() throws Exception {
|
||||||
|
|
||||||
assertEquals(60, type.getLength());
|
assertEquals(60, type.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class ScalarTypeZoneOffsetTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testGetLength() throws Exception {
|
public void testGetLength() throws Exception {
|
||||||
|
|
||||||
assertEquals(60, type.getLength());
|
assertEquals(60, type.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -100,9 +100,9 @@ class TestTypeManager extends BaseTest {
|
|||||||
DefaultTypeManager typeManager = createTypeManager();
|
DefaultTypeManager typeManager = createTypeManager();
|
||||||
|
|
||||||
ScalarType<?> scalarType = typeManager.getScalarType(Money.class);
|
ScalarType<?> scalarType = typeManager.getScalarType(Money.class);
|
||||||
assertEquals(Types.DECIMAL, scalarType.getJdbcType());
|
assertEquals(Types.DECIMAL, scalarType.jdbcType());
|
||||||
assertFalse(scalarType.isJdbcNative());
|
assertFalse(scalarType.jdbcNative());
|
||||||
assertEquals(Money.class, scalarType.getType());
|
assertEquals(Money.class, scalarType.type());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
+1
-1
@@ -158,7 +158,7 @@ public class ModelBuildContext {
|
|||||||
if (p.isLocalEncrypted()) {
|
if (p.isLocalEncrypted()) {
|
||||||
// scalar type potentially wrapping varbinary db type
|
// scalar type potentially wrapping varbinary db type
|
||||||
ScalarType<Object> scalarType = p.scalarType();
|
ScalarType<Object> scalarType = p.scalarType();
|
||||||
int jdbcType = scalarType.getJdbcType();
|
int jdbcType = scalarType.jdbcType();
|
||||||
return dbTypeMap.get(jdbcType);
|
return dbTypeMap.get(jdbcType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,17 +62,17 @@ abstract class ScalarTypePgisBase<T extends Geometry> implements ScalarType<T> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isJdbcNative() {
|
public boolean jdbcNative() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getJdbcType() {
|
public int jdbcType() {
|
||||||
return jdbcType;
|
return jdbcType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<T> getType() {
|
public Class<T> type() {
|
||||||
return cls;
|
return cls;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ abstract class ScalarTypePgisBase<T extends Geometry> implements ScalarType<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,17 +28,17 @@ abstract class ScalarTypeGeoLatteBase<T extends Geometry> implements ScalarType<
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isJdbcNative() {
|
public boolean jdbcNative() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getJdbcType() {
|
public int jdbcType() {
|
||||||
return jdbcType;
|
return jdbcType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<T> getType() {
|
public Class<T> type() {
|
||||||
return cls;
|
return cls;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ abstract class ScalarTypeGeoLatteBase<T extends Geometry> implements ScalarType<
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocPropertyType getDocType() {
|
public DocPropertyType docType() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user