public static Date doNowOrToday(String value, String colType) throws DateParseException {
        if (!isNowOrTodayFormat(value)) {
            return null;
        }

        Calendar c = Calendar.getInstance();
        String lowerValue = value.toLowerCase();
        if (lowerValue.startsWith(NOW)) {
            parseNow(value, lowerValue, c);
        } else if (lowerValue.startsWith(TODAY)) {
            parseToday(value, lowerValue, c);
        } else {
            throw new DateParseException("Programmer error: " + value + " does not start with 'NOW' or 'TODAY'");
        }

        Date today = c.getTime();

        if (colType == null || colType.length() == 0) {
            throw new DateParseException("Must supply non-null column type when using 'NOW' or 'TODAY' value.");
        } else if (colType.equalsIgnoreCase("timestamp")) {
            return new java.sql.Timestamp(today.getTime());
        } else if (colType.equalsIgnoreCase("time")) {
            // A little odd using TODAY format with a TIME type column, but we'll do it - will get current time...
            return new java.sql.Time(today.getTime());
        } else if (colType.equalsIgnoreCase("date") || colType.equalsIgnoreCase("datetime")) {
            return new java.sql.Date(today.getTime());
        } else {
            throw new DateParseException("Unrecognized colType " + colType
                    + " when using 'NOW' or 'TODAY' value; expected one of date, time, datetime, or timestamp");
        }

    }
public static Date doNowOrToday(String value, String colType) throws DateParseException {
        if (!isNowOrTodayFormat(value)) {
            return null;
        }

        Calendar c = Calendar.getInstance();
        String lowerValue = value.toLowerCase();
        if (lowerValue.startsWith(NOW)) {
            parseNow(value, lowerValue, c);
        } else if (lowerValue.startsWith(TODAY)) {
            parseToday(value, lowerValue, c);
        } else {
            throw new DateParseException("Programmer error: " + value + " does not start with 'NOW' or 'TODAY'");
        }

        Date today = c.getTime();

        if (colType == null || colType.length() == 0) {
            throw new DateParseException("Must supply non-null column type when using 'NOW' or 'TODAY' value.");
        } else if (colType.equalsIgnoreCase("timestamp")) {
            return new java.sql.Timestamp(today.getTime());
        } else if (colType.equalsIgnoreCase("time")) {
            
            return new java.sql.Time(today.getTime());
        } else if (colType.equalsIgnoreCase("date") || colType.equalsIgnoreCase("datetime")) {
            return new java.sql.Date(today.getTime());
        } else {
            throw new DateParseException("Unrecognized colType " + colType
                    + " when using 'NOW' or 'TODAY' value; expected one of date, time, datetime, or timestamp");
        }

    }
public static Date doNowOrToday ( String value , String colType ) throws DateParseException { if ( ! isNowOrTodayFormat ( value ) ) { return null ; } Calendar c = Calendar . getInstance ( ) ; String lowerValue = value . toLowerCase ( ) ; if ( lowerValue . startsWith ( NOW ) ) { parseNow ( value , lowerValue , c ) ; } else if ( lowerValue . startsWith ( TODAY ) ) { parseToday ( value , lowerValue , c ) ; } else { throw new DateParseException ( "Programmer error: " + value + " does not start with 'NOW' or 'TODAY'" ) ; } Date today = c . getTime ( ) ; if ( colType == null || colType . length ( ) == 0 ) { throw new DateParseException ( "Must supply non-null column type when using 'NOW' or 'TODAY' value." ) ; } else if ( colType . equalsIgnoreCase ( "timestamp" ) ) { return new java . sql . Timestamp ( today . getTime ( ) ) ; } else if ( colType . equalsIgnoreCase ( "time" ) ) { // A little odd using TODAY format with a TIME type column, but we'll do it - will get current time... return new java . sql . Time ( today . getTime ( ) ) ; } else if ( colType . equalsIgnoreCase ( "date" ) || colType . equalsIgnoreCase ( "datetime" ) ) { return new java . sql . Date ( today . getTime ( ) ) ; } else { throw new DateParseException ( "Unrecognized colType " + colType + " when using 'NOW' or 'TODAY' value; expected one of date, time, datetime, or timestamp" ) ; } }
CHECKSTYLE:OFF Cyclomatic Complexity
CHECKSTYLE : OFF Cyclomatic Complexity