001    package railo.runtime.type.trace;
002    
003    import railo.runtime.PageContext;
004    import railo.runtime.debug.Debugger;
005    import railo.runtime.dump.DumpData;
006    import railo.runtime.dump.DumpProperties;
007    import railo.runtime.dump.DumpUtil;
008    import railo.runtime.exp.PageException;
009    import railo.runtime.op.Caster;
010    import railo.runtime.op.Operator;
011    import railo.runtime.type.Collection.Key;
012    import railo.runtime.type.KeyImpl;
013    import railo.runtime.type.Objects;
014    import railo.runtime.type.Struct;
015    import railo.runtime.type.dt.DateTime;
016    import railo.runtime.util.VariableUtilImpl;
017    
018    public class TOObjects extends TraceObjectSupport implements Objects {
019            
020            private static final long serialVersionUID = -2011026266467450312L;
021    
022            protected TOObjects(Debugger debugger,Object obj,int type,String category,String text) {
023                    super(debugger,obj,type,category,text);
024            }
025    
026            /**
027             * @see railo.runtime.dump.Dumpable#toDumpData(railo.runtime.PageContext, int, railo.runtime.dump.DumpProperties)
028             */
029            public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties properties) {
030                    log();
031                    return DumpUtil.toDumpData(o, pageContext, maxlevel, properties);
032            }
033    
034            /**
035             * @see railo.runtime.op.Castable#castToString()
036             */
037            public String castToString() throws PageException {
038                    log();
039                    return Caster.toString(o);
040            }
041            
042            /**
043             * @see railo.runtime.op.Castable#castToString(java.lang.String)
044             */
045            public String castToString(String defaultValue) {
046                    log();
047                    return Caster.toString(o,defaultValue);
048            }
049            
050            /**
051             * @see railo.runtime.op.Castable#castToBooleanValue()
052             */
053            public boolean castToBooleanValue() throws PageException {
054                    log();
055                    return Caster.toBooleanValue(o);
056            }
057            
058            /**
059             * @see railo.runtime.op.Castable#castToBoolean(java.lang.Boolean)
060             */
061            public Boolean castToBoolean(Boolean defaultValue) {
062                    log();
063                    return Caster.toBoolean(o,defaultValue);
064            }
065            
066            /**
067             * @see railo.runtime.op.Castable#castToDoubleValue()
068             */
069            public double castToDoubleValue() throws PageException {
070                    log();
071                    return Caster.toDoubleValue(o);
072            }
073            
074            /**
075             * @see railo.runtime.op.Castable#castToDoubleValue(double)
076             */
077            public double castToDoubleValue(double defaultValue) {
078                    log();
079                    return Caster.toDoubleValue(o,defaultValue);
080            }
081            
082            /**
083             * @see railo.runtime.op.Castable#castToDateTime()
084             */
085            public DateTime castToDateTime() throws PageException {
086                    log();
087                    return new TODateTime(debugger,Caster.toDate(o, false,null),type,category,text);
088            }
089            
090            /**
091             * @see railo.runtime.op.Castable#castToDateTime(railo.runtime.type.dt.DateTime)
092             */
093            public DateTime castToDateTime(DateTime defaultValue) {
094                    log();
095                    return new TODateTime(debugger,Caster.toDate(o, false,null,defaultValue),type,category,text);
096            }
097            
098            /**
099             * @see railo.runtime.op.Castable#compareTo(boolean)
100             */
101            public int compareTo(boolean b) throws PageException {
102                    log();
103                    return Operator.compare(o, b);
104            }
105            
106            /**
107             * @see railo.runtime.op.Castable#compareTo(railo.runtime.type.dt.DateTime)
108             */
109            public int compareTo(DateTime dt) throws PageException {
110                    log();
111                    return Operator.compare(o, (Object)dt);
112            }
113    
114            /**
115             * @see railo.runtime.op.Castable#compareTo(double)
116             */
117            public int compareTo(double d) throws PageException {
118                    log();
119                    return Operator.compare(o, d);
120            }
121            
122            /**
123             * @see railo.runtime.op.Castable#compareTo(java.lang.String)
124             */
125            public int compareTo(String str) throws PageException {
126                    log();
127                    return Operator.compare(o, str);
128            }
129    
130            /**
131             * @see railo.runtime.type.Objects#get(railo.runtime.PageContext, railo.runtime.type.Collection.Key)
132             */
133            public Object get(PageContext pc, Key key) throws PageException {
134                    log(key.getString());
135                    VariableUtilImpl var = (VariableUtilImpl) pc.getVariableUtil();
136                    return var.get(pc, o, key);
137                    //return TraceObjectSupport.toTraceObject(debugger,var.get(pc, o, key),type,category,text);
138            }
139            
140            /**
141             * @see railo.runtime.type.Objects#get(railo.runtime.PageContext, railo.runtime.type.Collection.Key, java.lang.Object)
142             */
143            public Object get(PageContext pc, Key key, Object defaultValue) {
144                    log(key.getString());
145                    VariableUtilImpl var = (VariableUtilImpl) pc.getVariableUtil();
146                    return var.get(pc, o, key, defaultValue);
147                    //return TraceObjectSupport.toTraceObject(debugger,var.get(pc, o, key, defaultValue),type,category,text);
148            }
149            
150            /**
151             * @see railo.runtime.type.Objects#set(railo.runtime.PageContext, railo.runtime.type.Collection.Key, java.lang.Object)
152             */
153            public Object set(PageContext pc, Key key, Object value) throws PageException {
154                    log(key,value);
155                    VariableUtilImpl var = (VariableUtilImpl) pc.getVariableUtil();
156                    return var.set(pc, o, key, value);
157                    //return TraceObjectSupport.toTraceObject(debugger,var.set(pc, o, key, value),type,category,text);
158            }
159            
160            /**
161             * @see railo.runtime.type.Objects#setEL(railo.runtime.PageContext, railo.runtime.type.Collection.Key, java.lang.Object)
162             */
163            public Object setEL(PageContext pc, Key key, Object value) {
164                    log(key,value);
165                    VariableUtilImpl var = (VariableUtilImpl) pc.getVariableUtil();
166                    return var.setEL(pc, o, key, value);
167                    //return TraceObjectSupport.toTraceObject(debugger,var.setEL(pc, o, key, value),type,category,text);
168            }
169            
170            /**
171             * @see railo.runtime.type.Objects#setEL(railo.runtime.PageContext, java.lang.String, java.lang.Object)
172             */
173            public Object setEL(PageContext pc, String propertyName, Object value) {
174                    return setEL(pc, KeyImpl.init(propertyName), value);
175                    //return TraceObjectSupport.toTraceObject(debugger,setEL(pc, KeyImpl.init(propertyName), value),type,category,text);
176            }
177            
178            /**
179             * @see railo.runtime.type.Objects#set(railo.runtime.PageContext, java.lang.String, java.lang.Object)
180             */
181            public Object set(PageContext pc, String propertyName, Object value) throws PageException {
182                    return set(pc, KeyImpl.init(propertyName), value);
183                    //return TraceObjectSupport.toTraceObject(debugger,set(pc, KeyImpl.init(propertyName), value),type,category,text);
184            }
185    
186            /**
187             * @see railo.runtime.type.Objects#call(railo.runtime.PageContext, railo.runtime.type.Collection.Key, java.lang.Object[])
188             */
189            public Object call(PageContext pc, Key key, Object[] args) throws PageException {
190                    log(key.getString());
191                    VariableUtilImpl var = (VariableUtilImpl) pc.getVariableUtil();
192                    return var.callFunctionWithoutNamedValues(pc, o, key, args);
193            }
194            
195            /**
196             * @see railo.runtime.type.Objects#callWithNamedValues(railo.runtime.PageContext, railo.runtime.type.Collection.Key, railo.runtime.type.Struct)
197             */
198            public Object callWithNamedValues(PageContext pc, Key key, Struct args) throws PageException {
199                    log(key.getString());
200                    VariableUtilImpl var = (VariableUtilImpl) pc.getVariableUtil();
201                    return var.callFunctionWithNamedValues(pc, o, key, args);
202            }
203            
204            /**
205             * @see railo.runtime.type.Objects#callWithNamedValues(railo.runtime.PageContext, java.lang.String, railo.runtime.type.Struct)
206             */
207            public Object callWithNamedValues(PageContext pc, String key, Struct args) throws PageException {
208                    return callWithNamedValues(pc, KeyImpl.init(key), args);
209            }
210    
211            /**
212             * @see railo.runtime.type.Objects#call(railo.runtime.PageContext, java.lang.String, java.lang.Object[])
213             */
214            public Object call(PageContext pc, String key, Object[] arguments) throws PageException {
215                    return call(pc, KeyImpl.init(key), arguments);
216            }
217            
218            /**
219             * @see railo.runtime.type.Objects#isInitalized()
220             */
221            public boolean isInitalized() {
222                    log();
223                    return true;
224            }
225    
226            /**
227             * @see railo.runtime.type.Objects#get(railo.runtime.PageContext, java.lang.String, java.lang.Object)
228             */
229            public Object get(PageContext pc, String propertyName, Object defaultValue) {
230                    return get(pc, KeyImpl.init(propertyName),defaultValue);
231                    //return TraceObjectSupport.toTraceObject(debugger,get(pc, KeyImpl.init(propertyName),defaultValue),type,category,text);
232            }
233            
234            /**
235             * @see railo.runtime.type.Objects#get(railo.runtime.PageContext, java.lang.String)
236             */
237            public Object get(PageContext pc, String propertyName) throws PageException {
238                    return get(pc, KeyImpl.init(propertyName));
239                    //return TraceObjectSupport.toTraceObject(debugger,get(pc, KeyImpl.init(propertyName)),type,category,text);
240            }
241    
242    }