package io.ebeaninternal.server.type;
public abstract class ScalarTypeBase<T> implements ScalarType<T> {
protected final Class<T> type;
protected final boolean jdbcNative;
protected final int jdbcType;
public ScalarTypeBase(Class<T> type, boolean jdbcNative, int jdbcType) {
this.type = type;
this.jdbcNative = jdbcNative;
this.jdbcType = jdbcType;
}
@Override
public long asVersion(T value) {
throw new RuntimeException("not supported");
}
@Override
public boolean isBinaryType() {
return false;
}
@Override
public boolean isMutable() {
return false;
}
@Override
public boolean isDirty(Object value) {
return true;
}
@Override
public int getLength() {
return 0;
}
@Override
public boolean isJdbcNative() {
return jdbcNative;
}
@Override
public int getJdbcType() {
return jdbcType;
}
@Override
public Class<T> getType() {
return type;
}
@Override
@SuppressWarnings("unchecked")
public String format(Object value) {
return formatValue((T) value);
}
@Override
public void loadIgnore(DataReader reader) {
reader.incrementPos(1);
}
}