001    package railo.runtime.op;
002    
003    import java.io.Serializable;
004    
005    import railo.runtime.exp.PageException;
006    import railo.runtime.type.dt.DateTime;
007    
008    /**
009     * Interface to define a Object as Castable, for Railo Type Casts
010     */
011    public interface Castable extends Serializable{
012    
013        /**
014         * cast the castable value to a string, other than the Method toString, this Method can throw a Exception
015         * @return String representation of the Object
016         * @throws PageException
017         */
018            public String castToString() throws PageException; 
019            
020        /**
021         * cast the castable value to a string, return the default value, when the method is not castable
022         * @return String representation of the Object
023         * @throws PageException
024         */
025            public String castToString(String defaultValue); 
026            
027            /**
028             * cast the castable value to a boolean value
029             * @return boolean Value representation of the Object
030             * @throws PageException
031             */
032            public boolean castToBooleanValue() throws PageException;
033            
034            /**
035             * cast the castable value to a boolean value
036             * @return boolean Value representation of the Object
037             * @throws PageException
038             */
039            public Boolean castToBoolean(Boolean defaultValue);
040            
041            /**
042             * cast the castable value to a double value
043             * @return double Value representation of the Object
044             * @throws PageException
045             */
046            public double castToDoubleValue() throws PageException;
047            
048            /**
049             * cast the castable value to a double value
050             * @return double Value representation of the Object
051             * @throws PageException
052             */
053            public double castToDoubleValue(double defaultValue);
054            
055            /**
056             * cast the castable value to a date time object
057             * @return date time  representation of the Object
058             * @throws PageException
059             */
060            public DateTime castToDateTime() throws PageException;
061            
062            /**
063             * cast the castable value to a date time object
064             * @param defaultValue returned when it is not possible to cast to a dateTime object
065             * @return date time  representation of the Object
066             * @throws PageException
067             */
068            public DateTime castToDateTime(DateTime defaultValue);
069    
070    
071        public int compareTo(String str) throws PageException;
072        public int compareTo(boolean b) throws PageException;
073        public int compareTo(double d) throws PageException;
074        public int compareTo(DateTime dt) throws PageException;
075    
076    
077    }