KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > cruisecontrol > util > PerDayScheduleItem


1 package net.sourceforge.cruisecontrol.util;
2
3 import java.text.DateFormatSymbols JavaDoc;
4 import java.util.Locale JavaDoc;
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 JavaDoc dayString) {
21         DateFormatSymbols JavaDoc symbols = new DateFormatSymbols JavaDoc(Locale.ENGLISH);
22         String JavaDoc[] 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