001    package railo.runtime.util;
002    
003    import railo.runtime.exp.PageException;
004    import railo.runtime.type.Collection;
005    import railo.runtime.type.Collection.Key;
006    
007    
008    
009    /**
010     * Object to test if a Object is a specific type
011     */
012    public interface Decision {
013    
014        /**
015         * tests if value is a simple value (Number,String,Boolean,Date,Printable)
016         * @param value value to test
017         * @return is value a simple value
018         */
019        public boolean isSimpleValue(Object value);
020    
021        /**
022         * tests if value is Numeric
023         * @param value value to test
024         * @return is value numeric
025         */
026        public boolean isNumeric(Object value);
027        
028        /**
029         * tests if String value is Numeric
030         * @param str value to test
031         * @return is value numeric
032         */
033        public boolean isNumeric(String str);
034    
035         /** tests if String value is Hex Value
036         * @param str value to test
037         * @return is value numeric
038         */
039        public boolean isHex(String str);
040    
041         /** tests if String value is UUID Value
042         * @param str value to test
043         * @return is value numeric
044         */
045        public boolean isUUID(String str);
046    
047        /**
048         * tests if value is a Boolean (Numbers are not acctepeted)
049         * @param value value to test
050         * @return is value boolean
051         */
052        public boolean isBoolean(Object value);
053    
054        /**
055         * tests if value is a Boolean
056         * @param str value to test
057         * @return is value boolean
058         */
059        public boolean isBoolean(String str);
060    
061        /**
062         * tests if value is DateTime Object
063         * @param value value to test
064         * @param alsoNumbers interpret also a number as date
065         * @return is value a DateTime Object
066         */
067        public boolean isDate(Object value,boolean alsoNumbers);
068    
069        /**
070         * tests if object is a struct 
071         * @param o
072         * @return is struct or not
073         */
074        public boolean isStruct(Object o);
075    
076        /**
077         * tests if object is a array 
078         * @param o
079         * @return is array or not
080         */
081        public boolean isArray(Object o);
082    
083        /**
084         * tests if object is a native java array 
085         * @param o
086         * @return is a native (java) array
087         */
088        public boolean isNativeArray(Object o);
089    
090        /**
091         * tests if object is a binary  
092         * @param object
093         * @return boolean
094         */
095        public boolean isBinary(Object object);
096    
097        /**
098         * tests if object is a Component  
099         * @param object
100         * @return boolean
101         */
102        public boolean isComponent(Object object);
103    
104        /**
105         * tests if object is a Query  
106         * @param object
107         * @return boolean
108         */
109        public boolean isQuery(Object object);
110    
111        /**
112         * tests if object is a binary  
113         * @param object
114         * @return boolean
115         */
116        public boolean isUserDefinedFunction(Object object);
117        
118        /**
119         * tests if year is a leap year 
120         * @param year year to check
121         * @return boolean
122         */
123        public boolean isLeapYear(int year);
124        
125        /**
126         * tests if object is a WDDX Object 
127         * @param o Object to check
128         * @return boolean
129         */
130        public boolean isWddx(Object o);
131        
132        /**
133         * tests if object is a XML Object 
134         * @param o Object to check
135         * @return boolean
136         */
137        public boolean isXML(Object o);
138        
139        /**
140         * tests if object is a XML Element Object 
141         * @param o Object to check
142         * @return boolean
143         */
144        public boolean isXMLElement(Object o);
145        
146        /**
147         * tests if object is a XML Document Object 
148         * @param o Object to check
149         * @return boolean
150         */
151        public boolean isXMLDocument(Object o);
152        
153        /**
154         * tests if object is a XML Root Element Object 
155         * @param o Object to check
156         * @return boolean
157         */
158        public boolean isXMLRootElement(Object o);
159    
160        /**
161         * @param string
162         * @return returns if string represent a variable name
163         */
164        public boolean isVariableName(String string);
165        
166        /**
167         * @param string
168         * @return returns if string represent a variable name
169         */
170        public boolean isSimpleVariableName(String string);
171    
172        /**
173         * returns if object is a CFML object
174         * @param o Object to check
175         * @return is or not
176         */
177        public boolean isObject(Object o);
178    
179        /**
180         * 
181         * @param str
182         * @return return if a String is "Empty", that means NULL or String with length 0 (whitespaces will not counted) 
183         */
184        public boolean isEmpty(String str);
185        
186        /**
187         * 
188         * @param str
189         * @param trim 
190         * @return return if a String is "Empty", that means NULL or String with length 0 (whitespaces will not counted) 
191         */
192        public boolean isEmpty(String str, boolean trim);
193    
194    
195            
196            public Key toKey(Object obj) throws PageException;
197            
198            public Key toKey(Object obj, Collection.Key defaultValue);
199            
200    }