001    package railo.runtime.sql.exp.value;
002    
003    import railo.runtime.exp.PageException;
004    import railo.runtime.op.Caster;
005    import railo.runtime.sql.exp.Literal;
006    import railo.runtime.type.dt.DateTime;
007    
008    
009    public class ValueDate extends ValueSupport implements Literal {
010    
011            private DateTime value;
012    
013            public ValueDate(DateTime value) {
014                    super(value.toString());
015                    this.value=value;
016            }
017            
018            public ValueDate(String strValue) throws PageException {
019                    super(strValue);
020                    this.value=Caster.toDate(strValue,false,null);
021            }
022    
023            /**
024             *
025             * @see java.lang.Object#toString()
026             */
027            public String toString(boolean noAlias) {
028                    if(noAlias || getIndex()==0)return getString();
029                    return getString()+" as "+getAlias();
030            }
031            
032            public Object getValue() {
033                    return value;
034            }
035            
036            public DateTime getValueAsDateTime() {
037                    return value;
038            }
039    }