001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.runtime.type.trace;
020
021import lucee.runtime.PageContext;
022import lucee.runtime.debug.Debugger;
023import lucee.runtime.dump.DumpData;
024import lucee.runtime.dump.DumpProperties;
025import lucee.runtime.exp.PageException;
026import lucee.runtime.type.Query;
027import lucee.runtime.type.QueryImpl;
028import lucee.runtime.type.dt.DateTime;
029
030public class TODateTime extends DateTime implements TraceObject {
031
032        private DateTime dt;
033        //private Debugger debugger;
034        private Query qry=new QueryImpl(
035            new String[]{"label","action","params","template","line","time"},
036            0,"traceObjects");
037        private int type;
038        private String category;
039        private String text;
040        private Debugger debugger;
041
042        
043
044        public TODateTime(Debugger debugger,DateTime dt, int type, String category, String text){
045                this.dt=dt;
046                this.debugger=debugger;
047                this.type=type;
048                this.category=category;
049                this.text=text;
050        }
051        
052        public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties properties) {
053                log();
054                return dt.toDumpData(pageContext, maxlevel, properties);
055        }
056
057        public String castToString() throws PageException {
058                log();
059                return dt.castToString();
060        }
061
062        public String castToString(String defaultValue) {
063                log();
064                return dt.castToString(defaultValue);
065        }
066
067        public boolean castToBooleanValue() throws PageException {
068                log();
069                return dt.castToBooleanValue();
070        }
071
072        public Boolean castToBoolean(Boolean defaultValue) {
073                log();
074                return dt.castToBoolean(defaultValue);
075        }
076
077        public double castToDoubleValue() throws PageException {
078                log();
079                return dt.castToDoubleValue();
080        }
081
082        public double castToDoubleValue(double defaultValue) {
083                log();
084                return dt.castToDoubleValue(defaultValue);
085        }
086
087        public DateTime castToDateTime() throws PageException {
088                log();
089                return this;
090        }
091
092        public DateTime castToDateTime(DateTime defaultValue) {
093                log();
094                return this;
095        }
096
097        public int compareTo(String str) throws PageException {
098                log();
099                return dt.compareTo(str);
100        }
101
102        public int compareTo(boolean b) throws PageException {
103                log();
104                return dt.compareTo(b);
105        }
106
107        public int compareTo(double d) throws PageException {
108                log();
109                return dt.compareTo(d);
110        }
111
112        public int compareTo(DateTime dt) throws PageException {
113                log();
114                return dt.compareTo(dt);
115        }
116
117        public double toDoubleValue() {
118                log();
119                return this.dt.toDoubleValue();
120        }
121        
122
123        protected void log() {
124                TraceObjectSupport.log(debugger,type,category,text,null,null);
125        }
126
127        public Query getDebugData() {
128                return qry;
129        }
130}