Merge pull request #2803 from ebean-orm/feature/refactor-scalarType-methodNames

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