001    package market;
002    
003    import java.text.SimpleDateFormat;
004    import java.util.Calendar;
005    import java.util.Date;
006    
007    
008    /**
009     * The time for the market.
010     */
011    public class CalendarTime extends sale.CalendarTime {
012    
013        /**
014             * ID for serialization.
015             */
016            private static final long serialVersionUID = -4802523893030496965L;
017    
018            public CalendarTime() {
019            super(Conversions.createToday().getTime().getTime());
020        }
021    
022        /**
023         * @return the current time.
024         */
025        public Object getTime() {
026            Date d = (Date)super.getTime();
027            SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
028            String datString = sdf.format(d);
029            return Conversions.stringToCalendar(datString);
030        }
031    
032        /**
033         * Sets a new time.
034         * @param oTime the time to be set.
035         * @throws IllegalArgumentException
036         */
037        public void setTime(Object oTime) throws IllegalArgumentException {
038            super.setTime(((Calendar)oTime).getTime());
039        }
040    }