com.fdsapi.arrays
Class DataTypeParser

java.lang.Object
  |
  +--com.fdsapi.arrays.DataTypeParser

public class DataTypeParser
extends java.lang.Object

Class used to determine the type of a passed in Object. The methods return true if the passed in data is of the same type as the method name would indicate.

Several of the String recognition methods were take from a posting on www.experts-exchange.com by maheshexp



View Code


Constructor Summary
DataTypeParser()
          Creates a new instance of DataTypeParser
 
Method Summary
 java.lang.Object getComparisonValue(java.lang.Object dataType, java.lang.String compValue)
          Takes a String from ArraySQL and converts it to the appropriate data type based on the comparison value.
 boolean isAlpha(char v)
           
 boolean isAlpha(java.lang.String str)
           
 boolean isAlphaNumeric(char v)
           
 boolean isAlphaNumeric(java.lang.String str)
           
 boolean isBigDecimal(java.lang.Object dataType)
           
 boolean isBigInteger(java.lang.Object dataType)
           
 boolean isBoolean(java.lang.Object dataType)
           
 boolean isCharacter(java.lang.Object dataType)
           
 boolean isDate(java.lang.Object dataType)
           
 boolean isDateString(java.lang.String str)
           
 boolean isDigit(char v)
           
 boolean isDouble(java.lang.Object dataType)
           
 boolean isFloat(java.lang.Object dataType)
           
 boolean isFloatString(java.lang.String str)
           
 boolean isInFormat(java.lang.String value)
           
 boolean isInteger(java.lang.Object dataType)
           
 boolean isIntegerString(java.lang.String str)
           
 boolean isLong(java.lang.Object dataType)
           
 boolean isNull(java.lang.Object dataType)
           
 boolean isQuotedString(java.lang.String str)
           
 boolean isShort(java.lang.Object dataType)
           
 boolean isString(java.lang.Object dataType)
           
 java.lang.String stripQuotes(java.lang.String str)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataTypeParser

public DataTypeParser()
Creates a new instance of DataTypeParser

Method Detail

isNull

public boolean isNull(java.lang.Object dataType)

isDate

public boolean isDate(java.lang.Object dataType)

isString

public boolean isString(java.lang.Object dataType)

isInteger

public boolean isInteger(java.lang.Object dataType)

isBoolean

public boolean isBoolean(java.lang.Object dataType)

isFloat

public boolean isFloat(java.lang.Object dataType)

isCharacter

public boolean isCharacter(java.lang.Object dataType)

isDouble

public boolean isDouble(java.lang.Object dataType)

isBigDecimal

public boolean isBigDecimal(java.lang.Object dataType)

isBigInteger

public boolean isBigInteger(java.lang.Object dataType)

isLong

public boolean isLong(java.lang.Object dataType)

isShort

public boolean isShort(java.lang.Object dataType)

isDigit

public boolean isDigit(char v)

isAlpha

public boolean isAlpha(char v)

isAlphaNumeric

public boolean isAlphaNumeric(char v)

isFloatString

public boolean isFloatString(java.lang.String str)

isIntegerString

public boolean isIntegerString(java.lang.String str)

isAlpha

public boolean isAlpha(java.lang.String str)

isAlphaNumeric

public boolean isAlphaNumeric(java.lang.String str)

isDateString

public boolean isDateString(java.lang.String str)

isQuotedString

public boolean isQuotedString(java.lang.String str)

stripQuotes

public java.lang.String stripQuotes(java.lang.String str)

isInFormat

public boolean isInFormat(java.lang.String value)

getComparisonValue

public java.lang.Object getComparisonValue(java.lang.Object dataType,
                                           java.lang.String compValue)
Takes a String from ArraySQL and converts it to the appropriate data type based on the comparison value. For example mydate='04/12/04' would know that the string should be converted to a date based on the fact that the data it is being compared to is a date. If the data in mydate was a String then a String comparison object would be returned, not a Date