package io.ebeaninternal.server.deploy.generatedproperty;
import io.ebean.bean.EntityBean;
import io.ebeaninternal.server.deploy.BeanProperty;
public class GeneratedCounterLong implements GeneratedProperty {
public GeneratedCounterLong() {
}
@Override
public Object getInsertValue(BeanProperty prop, EntityBean bean, long now) {
return 1L;
}
@Override
public Object getUpdateValue(BeanProperty prop, EntityBean bean, long now) {
Long val = (Long) prop.getValue(bean);
if (val == null) {
throw new IllegalStateException("version property has been set to null on bean: " + bean);
}
return val + 1;
}
@Override
public boolean includeInUpdate() {
return true;
}
@Override
public boolean includeInAllUpdates() {
return false;
}
@Override
public boolean includeInInsert() {
return true;
}
@Override
public boolean isDDLNotNullable() {
return true;
}
}