com.jpattern.orm.generator.wrapper.VersionIncreaseHelper Maven / Gradle / Ivy
package com.jpattern.orm.generator.wrapper;
import java.math.BigDecimal;
import java.math.BigInteger;
import org.joda.time.DateTime;
/**
*
* @author Francesco Cina'
*
* Mar 24, 2012
*/
public abstract class VersionIncreaseHelper {
public static byte increase(byte value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return 0;
}
return ++value;
}
public static short increase(short value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return 0;
}
return ++value;
}
public static int increase(int value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return 0;
}
return ++value;
}
public static long increase(long value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return 0;
}
return ++value;
}
public static float increase(float value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return 0;
}
return ++value;
}
public static double increase(double value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return 0;
}
return ++value;
}
public static Byte increase(Byte value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return 0;
}
return ++value;
}
public static Short increase(Short value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return 0;
}
return ++value;
}
public static Integer increase(Integer value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return 0;
}
return ++value;
}
public static Long increase(Long value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return 0l;
}
return ++value;
}
public static Float increase(Float value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return 0f;
}
return ++value;
}
public static Double increase(Double value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return 0d;
}
return ++value;
}
public static BigDecimal increase(BigDecimal value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return BigDecimal.ZERO;
}
return value.add(BigDecimal.ONE);
}
public static BigInteger increase(BigInteger value, boolean firstVersionNumber) {
if (firstVersionNumber) {
return BigInteger.ZERO;
}
return value.add(BigInteger.ONE);
}
public static java.util.Date increase(java.util.Date value, boolean firstVersionNumber) {
return new java.util.Date();
}
public static DateTime increase(DateTime value, boolean firstVersionNumber) {
return DateTime.now();
}
public static java.sql.Date increase(java.sql.Date value, boolean firstVersionNumber) {
return new java.sql.Date( new java.util.Date().getTime() );
}
public static java.sql.Timestamp increase(java.sql.Timestamp value, boolean firstVersionNumber) {
return new java.sql.Timestamp( new java.util.Date().getTime() );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy