All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jpattern.orm.generator.wrapper.VersionIncreaseHelper Maven / Gradle / Ivy

There is a newer version: 3.5.1
Show newest version
package com.jpattern.orm.generator.wrapper;

import java.math.BigDecimal;

/**
 * 
 * @author Francesco Cina'
 *
 * Mar 24, 2012
 */
public abstract class VersionIncreaseHelper {

	public static byte increase(boolean firstVersionNumber, byte value) {
		if (firstVersionNumber) {
			return 0;
		}
		return ++value;
	}

	public static short increase(boolean firstVersionNumber, short value) {
		if (firstVersionNumber) {
			return 0;
		}
		return ++value;
	}

	public static int increase(boolean firstVersionNumber, int value) {
		if (firstVersionNumber) {
			return 0;
		}
		return ++value;
	}

	public static long increase(boolean firstVersionNumber, long value) {
		if (firstVersionNumber) {
			return 0;
		}
		return ++value;
	}

	public static float increase(boolean firstVersionNumber, float value) {
		if (firstVersionNumber) {
			return 0;
		}
		return ++value;
	}

	public static double increase(boolean firstVersionNumber, double value) {
		if (firstVersionNumber) {
			return 0;
		}
		return ++value;
	}

	//	public static Byte increase(boolean firstVersionNumber, Byte value) {
	//		if (firstVersionNumber || (value==null)) {
	//			return 0;
	//		}
	//		return ++value;
	//	}
	//
	//	public static Short increase(boolean firstVersionNumber, Short value) {
	//		if (firstVersionNumber || (value==null)) {
	//			return 0;
	//		}
	//		return ++value;
	//	}
	//
	//	public static Integer increase(boolean firstVersionNumber, Integer value) {
	//		if (firstVersionNumber || (value==null)) {
	//			return 0;
	//		}
	//		return ++value;
	//	}
	//
	//	public static Long increase(boolean firstVersionNumber, Long value) {
	//		if (firstVersionNumber || (value==null)) {
	//			return 0l;
	//		}
	//		return ++value;
	//	}
	//
	//	public static Float increase(boolean firstVersionNumber, Float value) {
	//		if (firstVersionNumber || (value==null)) {
	//			return 0f;
	//		}
	//		return ++value;
	//	}
	//
	//	public static Double increase(boolean firstVersionNumber, Double value) {
	//		if (firstVersionNumber || (value==null)) {
	//			return 0d;
	//		}
	//		return ++value;
	//	}

	public static BigDecimal increase(boolean firstVersionNumber, BigDecimal value) {
		if (firstVersionNumber || (value==null)) {
			return BigDecimal.ZERO;
		}
		return value.add(BigDecimal.ONE);
	}

	//	public static BigInteger increase(boolean firstVersionNumber, BigInteger value) {
	//		if (firstVersionNumber || (value==null)) {
	//			return BigInteger.ZERO;
	//		}
	//		return value.add(BigInteger.ONE);
	//	}

	public static java.sql.Date increase(boolean firstVersionNumber, java.sql.Date value) {
		return new java.sql.Date( new java.util.Date().getTime() );
	}

	public static java.sql.Timestamp increase(boolean firstVersionNumber, java.sql.Timestamp value) {
		return new java.sql.Timestamp( new java.util.Date().getTime() );
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy