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.op;
020
021import lucee.commons.lang.StringUtil;
022import lucee.runtime.exp.PageException;
023import lucee.runtime.type.Collection.Key;
024import lucee.runtime.type.KeyImpl;
025
026
027/**
028 * implementation of the interface Decision
029 */
030public final class DecisionImpl implements lucee.runtime.util.Decision {
031
032    private static DecisionImpl singelton;
033
034    @Override
035    public boolean isArray(Object o) {
036        return Decision.isArray(o);
037    }
038
039    @Override
040    public boolean isBinary(Object object) {
041        return Decision.isBinary(object);
042    }
043
044    @Override
045    public boolean isBoolean(Object value) {
046        return Decision.isBoolean(value);
047    }
048
049    @Override
050    public boolean isBoolean(String str) {
051        return Decision.isBoolean(str);
052    }
053
054    @Override
055    public boolean isComponent(Object object) {
056        return Decision.isComponent(object);
057    }
058
059    @Override
060    public boolean isDate(Object value, boolean alsoNumbers) {
061        return Decision.isDateAdvanced(value,alsoNumbers);
062    }
063
064    @Override
065    public boolean isEmpty(String str, boolean trim) {
066        return StringUtil.isEmpty(str,trim);
067    }
068
069    @Override
070    public boolean isEmpty(String str) {
071        return StringUtil.isEmpty(str);
072    }
073
074    @Override
075    public boolean isHex(String str) {
076        return Decision.isHex(str);
077    }
078
079    @Override
080    public boolean isLeapYear(int year) {
081        return Decision.isLeapYear(year);
082    }
083
084    @Override
085    public boolean isNativeArray(Object o) {
086        return Decision.isNativeArray(o);
087    }
088
089    @Override
090    public boolean isNumeric(Object value) {
091        return Decision.isNumeric(value);
092    }
093
094    @Override
095    public boolean isNumeric(String str) {
096        return Decision.isNumeric(str);
097    }
098
099    @Override
100    public boolean isObject(Object o) {
101        return Decision.isObject(o);
102    }
103
104    @Override
105    public boolean isQuery(Object object) {
106        return Decision.isQuery(object);
107    }
108
109    @Override
110    public boolean isSimpleValue(Object value) {
111        return Decision.isSimpleValue(value);
112    }
113
114    @Override
115    public boolean isSimpleVariableName(String string) {
116        return Decision.isSimpleVariableName(string);
117    }
118
119    @Override
120    public boolean isStruct(Object o) {
121        return Decision.isStruct(o);
122    }
123
124    @Override
125    public boolean isUserDefinedFunction(Object object) {
126        return Decision.isUserDefinedFunction(object);
127    }
128
129    @Override
130    public boolean isUUID(String str) {
131        return Decision.isUUId(str);
132    }
133
134    @Override
135    public boolean isVariableName(String string) {
136        return Decision.isVariableName(string);
137    }
138
139    @Override
140    public boolean isWddx(Object o) {
141        return Decision.isWddx(o);
142    }
143
144    @Override
145    public boolean isXML(Object o) {
146        return Decision.isXML(o);
147    }
148
149    @Override
150    public boolean isXMLDocument(Object o) {
151        return Decision.isXMLDocument(o);
152    }
153
154    @Override
155    public boolean isXMLElement(Object o) {
156        return Decision.isXMLElement(o);
157    }
158
159    @Override
160    public boolean isXMLRootElement(Object o) {
161        return Decision.isXMLRootElement(o);
162    }
163
164    public static lucee.runtime.util.Decision getInstance() {
165        if(singelton==null)singelton=new DecisionImpl();
166        return singelton;
167    }
168
169        @Override
170        public Key toKey(Object obj) throws PageException {
171                return KeyImpl.toKey(obj);
172        }
173
174        @Override
175        public Key toKey(Object obj, Key defaultValue) {
176                return KeyImpl.toKey(obj,defaultValue);
177        }
178
179}