Remove ScalarType.isDateTimeCapable() ... (only used by CSV reader)

So the complexity cost doesn't justify itself against only being used
by CSV reader to validate when assigning a date/time format to a property
/ expression path.
This commit is contained in:
Rob Bygrave committed 2022-08-25 12:16:37 +12:00
1 parent 3092b59622
commit 10c9b2addd
29 files changed
+4 -159

No files matched your search

@@ -180,11 +180,6 @@ public final class BeanFkeyProperty implements ElPropertyValue {
return prefix;
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public int jdbcType() {
return 0;
@@ -940,11 +940,6 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
return scalarType;
}
@Override
public boolean isDateTimeCapable() {
return scalarType != null && scalarType.isDateTimeCapable();
}
@Override
public int jdbcType() {
return scalarType == null ? 0 : scalarType.getJdbcType();
@@ -227,12 +227,6 @@ public final class ElPropertyChain implements ElPropertyValue {
return lastBeanProperty;
}
@Override
public boolean isDateTimeCapable() {
return scalarType != null && scalarType.isDateTimeCapable();
}
@Override
public int jdbcType() {
return scalarType == null ? 0 : scalarType.getJdbcType();
@@ -123,11 +123,7 @@ public class TCsvReader<T> implements CsvReader<T> {
@Override
public void addDateTime(String propertyName, String dateTimeFormat, Locale locale) {
ExpressionPath elProp = descriptor.expressionPath(propertyName);
if (!elProp.isDateTimeCapable()) {
throw new TextException("Property " + propertyName + " is not DateTime capable");
}
if (dateTimeFormat == null) {
dateTimeFormat = getDefaultDateTimeFormat(elProp.jdbcType());
}
@@ -82,11 +82,6 @@ abstract class ScalarTypeBaseDate<T> extends ScalarTypeBase<T> {
return convertFromDate(ts);
}
@Override
public boolean isDateTimeCapable() {
return true;
}
@Override
public T jsonRead(JsonParser parser) throws IOException {
if (JsonToken.VALUE_NUMBER_INT == parser.getCurrentToken()) {
@@ -160,11 +160,6 @@ abstract class ScalarTypeBaseDateTime<T> extends ScalarTypeBase<T> {
}
}
@Override
public boolean isDateTimeCapable() {
return true;
}
@Override
public T readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -62,11 +62,6 @@ class ScalarTypeBigDecimal extends ScalarTypeBase<BigDecimal> {
return BigDecimal.valueOf(systemTimeMillis);
}
@Override
public boolean isDateTimeCapable() {
return true;
}
@Override
public BigDecimal readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -52,11 +52,6 @@ public final class ScalarTypeBytesEncrypted implements ScalarType<byte[]> {
return byte[].class;
}
@Override
public boolean isDateTimeCapable() {
return baseType.isDateTimeCapable();
}
@Override
public boolean isJdbcNative() {
return baseType.isJdbcNative();
@@ -61,11 +61,6 @@ final class ScalarTypeDouble extends ScalarTypeBase<Double> {
return (double) systemTimeMillis;
}
@Override
public boolean isDateTimeCapable() {
return true;
}
@Override
public Double readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -94,11 +94,6 @@ public final class ScalarTypeEncryptedWrapper<T> implements ScalarType<T>, Local
return wrapped.getType();
}
@Override
public boolean isDateTimeCapable() {
return wrapped.isDateTimeCapable();
}
@Override
public boolean isJdbcNative() {
return false;
@@ -61,11 +61,6 @@ final class ScalarTypeFloat extends ScalarTypeBase<Float> {
return (float) systemTimeMillis;
}
@Override
public boolean isDateTimeCapable() {
return true;
}
@Override
public Float readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -91,11 +91,6 @@ final class ScalarTypeInteger extends ScalarTypeBase<Integer> {
throw new TextException("Not Supported");
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public Integer jsonRead(JsonParser parser) throws IOException {
return parser.getIntValue();
@@ -77,11 +77,6 @@ class ScalarTypeJodaLocalTime extends ScalarTypeBase<LocalTime> {
return new LocalTime(systemTimeMillis, DateTimeZone.getDefault());
}
@Override
public boolean isDateTimeCapable() {
return true;
}
@Override
public LocalTime readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -86,11 +86,6 @@ class ScalarTypeLocalTime extends ScalarTypeBase<LocalTime> {
return LocalTime.parse(value);
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public LocalTime convertFromMillis(long systemTimeMillis) {
throw new TextException("Not Supported");
@@ -71,11 +71,6 @@ final class ScalarTypeLong extends ScalarTypeBase<Long> {
return systemTimeMillis;
}
@Override
public boolean isDateTimeCapable() {
return true;
}
@Override
public Long readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -66,11 +66,6 @@ final class ScalarTypeMathBigInteger extends ScalarTypeBase<BigInteger> {
return BigInteger.valueOf(systemTimeMillis);
}
@Override
public boolean isDateTimeCapable() {
return true;
}
@Override
public BigInteger readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -61,11 +61,6 @@ abstract class ScalarTypeStringBase extends ScalarTypeBase<String> {
return String.valueOf(systemTimeMillis);
}
@Override
public boolean isDateTimeCapable() {
return true;
}
@Override
public String readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -62,11 +62,6 @@ final class ScalarTypeTime extends ScalarTypeBase<Time> {
return new Time(systemTimeMillis);
}
@Override
public boolean isDateTimeCapable() {
return true;
}
@Override
public Time readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -99,11 +99,6 @@ public class ScalarTypeWrapper<B, S> implements ScalarType<B> {
return wrapperType;
}
@Override
public boolean isDateTimeCapable() {
return scalarType.isDateTimeCapable();
}
@Override
public boolean isJdbcNative() {
return false;