package org.minimalj.model.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotation for String, Long, Integer, BigDecimal.
 * 
 * <UL>
 * <LI>For String its mandatory.
 * <LI>For Integer or Long the default size is defined by the size of the java values
 * <LI>For BigDecimal the default size is 10 (with scale of 0) as in MySql DB
 * <LI>For Time the defined constants must be used
 * </UL>
 * 
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
public @interface Size {

	int value();
	
	/**
	 * Constant to annotate the precision of LocalDate fields to minutes
	 */
	public static final int TIME_HH_MM = 4;

	/**
	 * Constant to annotate the precision of LocalDate fields to seconds
	 */
	public static final int TIME_WITH_SECONDS = 6;

	/**
	 * Constant to annotate the precision of LocalDate fields to milliseconds
	 */
	public static final int TIME_WITH_MILLIS = 9;
	

	/**
	 * Maximum size of an Integer (unsigned)
	 */
	public static final int INTEGER = String.valueOf(Integer.MAX_VALUE).length();

	/**
	 * Maximum size of a Long (unsigned)
	 */
	public static final int LONG = String.valueOf(Long.MAX_VALUE).length();
	
	
	/**
	 * The default size (number of digits) for BigDecimals.
	 * Note: 10 is als the default used in MariaDB.
	 */
	public static final int BIG_DECIMAL_DEFAULT = 10;

}

@@ -778,9 +778,9 @@
 M = 
-4
+5
 ;%0A%0A%09
@@ -907,9 +907,9 @@
 S = 
-6
+8
 ;%0A%0A%09
@@ -1040,9 +1040,10 @@
 S = 
-9
+12
 ;%0A%09%0A

use readable time formats for time size lengths