KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > scheduling > ScheduleInstructionListType


1 /*
2  * Copyright (c) 2005, Rob Gordon.
3  */

4 package org.oddjob.scheduling;
5
6 import java.util.ArrayList JavaDoc;
7 import java.util.List JavaDoc;
8
9 import org.oddjob.arooa.ArooaHandler;
10 import org.oddjob.arooa.ArooaContext;
11
12 /**
13  * @oddjob.description A list of ScheduleInstructions.
14  *
15  * @author Rob Gordon.
16  */

17 public class ScheduleInstructionListType {
18     
19     /**
20      * @oddjob.element values
21      * @oddjob.description Any values.
22      * @oddjob.required No.
23      */

24     private final transient List JavaDoc values = new ArrayList JavaDoc();
25                 
26     /**
27      * Add a value to the list.
28      *
29      * @param type The type.
30      */

31     public void addConfiguredValue(Object JavaDoc type) {
32         values.add(type);
33     }
34     
35     public Object JavaDoc valueFor(Class JavaDoc required)
36     throws ClassCastException JavaDoc, NumberFormatException JavaDoc {
37         return (ScheduleInstruction[]) values
38                 .toArray(new ScheduleInstruction[0]);
39     }
40
41
42     public String JavaDoc toString() {
43         return "List of " + values.size() + " things.";
44     }
45     
46     /**
47      * Provide our own handler for the values.
48      *
49      * @param context Not required.
50      * @return Our handler.
51      */

52     public ArooaHandler handlerFor(ArooaContext context) {
53         return ScheduleInstructionFactory.handlerFor(context);
54     }
55         
56 }
57
Popular Tags