1 package net.sourceforge.cruisecontrol.util; 2 3 import java.text.DateFormatSymbols ; 4 import java.util.Locale ; 5 6 import org.apache.log4j.Logger; 7 8 public class PerDayScheduleItem { 9 10 public static final int NOT_SET = -1; 11 protected static final int INVALID_NAME_OF_DAY = -2; 12 private static final Logger LOG = Logger.getLogger(PerDayScheduleItem.class); 13 14 private int day = NOT_SET; 15 16 public int getDay() { 17 return day; 18 } 19 20 public void setDay(String dayString) { 21 DateFormatSymbols symbols = new DateFormatSymbols (Locale.ENGLISH); 22 String [] weekdays = symbols.getWeekdays(); 23 for (int i = 1; i < weekdays.length; i++) { 24 if (dayString.equalsIgnoreCase(weekdays[i])) { 25 day = i; 26 return; 27 } 28 } 29 day = INVALID_NAME_OF_DAY; 30 LOG.warn("invalid value for day attribute \"" + dayString + "\"; must be English name for day of week"); 31 } 32 33 } 34 | Popular Tags |