package org.assertj.db.api;

import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;

/**
 * Enumeration of the different type of value that are in the database.
 * 
 * @author Régis Pouiller
 * 
 */
public enum ValueType {

  /**
   * Bytes type.
   */
  BYTES,
  /**
   * Boolean type.
   */
  BOOLEAN,
  /**
   * Text type (CHAR or VARCHAR column).
   */
  TEXT,
  /**
   * Date type.
   */
  DATE,
  /**
   * Time type.
   */
  TIME,
  /**
   * Date/time type (TIMESTAMP column).
   */
  DATE_TIME,
  /**
   * Number type (INT, SMALLINT, TINYINT, BIGINT, REAL or DECIMAL column).
   */
  NUMBER,
  /**
   * Not identified type : null value for example.
   */
  NOT_IDENTIFIED;

  /**
   * Returns the type of the actual value (data).
   * 
   * @param pValue The actual value
   * @return The type of the actual value
   */
  public static ValueType getType(final Object pValue) {
    if (pValue instanceof byte[]) {
      return BYTES;
    }
    if (pValue instanceof Boolean) {
      return BOOLEAN;
    }
    if (pValue instanceof String) {
      return TEXT;
    }
    if (pValue instanceof Date) {
      return DATE;
    }
    if (pValue instanceof Time) {
      return TIME;
    }
    if (pValue instanceof Timestamp) {
      return DATE_TIME;
    }
    if (pValue instanceof Byte
        || pValue instanceof Short
        || pValue instanceof Integer
        || pValue instanceof Long
        || pValue instanceof Float
        || pValue instanceof BigDecimal) {

      return NUMBER;
    }
    return NOT_IDENTIFIED;
  }
}

@@ -793,18 +793,17 @@
  @param 
-pV
+v
 alue The
@@ -911,18 +911,17 @@
  Object 
-pV
+v
 alue) %7B%0A
@@ -920,34 +920,33 @@
 alue) %7B%0A    if (
-pV
+v
 alue instanceof 
@@ -981,34 +981,33 @@
 ;%0A    %7D%0A    if (
-pV
+v
 alue instanceof 
@@ -1045,34 +1045,33 @@
 ;%0A    %7D%0A    if (
-pV
+v
 alue instanceof 
@@ -1105,34 +1105,33 @@
 ;%0A    %7D%0A    if (
-pV
+v
 alue instanceof 
@@ -1163,34 +1163,33 @@
 ;%0A    %7D%0A    if (
-pV
+v
 alue instanceof 
@@ -1221,34 +1221,33 @@
 ;%0A    %7D%0A    if (
-pV
+v
 alue instanceof 
@@ -1297,18 +1297,17 @@
     if (
-pV
+v
 alue ins
@@ -1322,34 +1322,33 @@
 Byte%0A        %7C%7C 
-pV
+v
 alue instanceof 
@@ -1356,34 +1356,33 @@
 hort%0A        %7C%7C 
-pV
+v
 alue instanceof 
@@ -1392,34 +1392,33 @@
 eger%0A        %7C%7C 
-pV
+v
 alue instanceof 
@@ -1425,34 +1425,33 @@
 Long%0A        %7C%7C 
-pV
+v
 alue instanceof 
@@ -1471,10 +1471,9 @@
  %7C%7C 
-pV
+v
 alue

Fix parameter name