1 //$Id: IAction.java 218 2006-03-02 23:23:29Z jg_hamburg $
2 /********************************************************************************
3 * DDTUnit, a Datadriven Approach to Unit- and Moduletesting
4 * Copyright (c) 2004, Joerg and Kai Gellien
5 * All rights reserved.
6 *
7 * The Software is provided under the terms of the Common Public License 1.0
8 * as provided with the distribution of DDTUnit in the file cpl-v10.html.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * + Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * + Redistributions in binary form must reproduce the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer in the documentation and/or other materials provided
19 * with the distribution.
20 *
21 * + Neither the name of the authors or DDTUnit, nor the
22 * names of its contributors may be used to endorse or promote
23 * products derived from this software without specific prior
24 * written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
30 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 ********************************************************************************/
38 package junitx.ddtunit.data.processing;
39
40 import junitx.ddtunit.data.TypedObject;
41
42 public interface IAction {
43 /**
44 * Used to append {@link TypedObject}that should be processed on this
45 * action.
46 */
47 IAction inject();
48
49 /**
50 * Create injected object to according type specification on this action.
51 * Just do nothing if object allready instanciated.
52 *
53 * @return RecordBase
54 * @throws ClassNotFoundException
55 * @throws InstantiationException
56 * @throws IllegalAccessException
57 */
58 TypedObject createObject();
59
60 TypedObject getObject();
61
62 void setObject(TypedObject tObj);
63
64 void setValue(Object obj);
65
66 Object getValue();
67
68 String getId();
69
70 /**
71 * do process required action to transition from this state
72 */
73 IAction process();
74
75 /**
76 * Process successor in action stack.
77 *
78 * @param successor action in stack
79 */
80 void processSuccessor(IAction successor);
81
82 /**
83 * Process action if no successor exists on action stack.
84 */
85 void processNoSuccessor();
86
87 IAction getNext();
88
89 void setNext(IAction next);
90
91 IAction getPrevious();
92
93 void setPrevious(IAction previous);
94
95 String getTypeFromRoot();
96
97 String getType();
98
99 void setType(String type);
100
101 /**
102 * Extract field type information from object sitting on the stack. <br/>If
103 * rootAction is a generated container action used for construction of
104 * fields or constructor call of the underlying object then skip the
105 * container action and retrieve requested type from underlying object.
106 *
107 * @param fieldName to extract type from
108 * @return full type of field
109 */
110 String extractFieldType(String fieldName);
111
112 String getHint();
113
114 /**
115 * Insert a new Record entry after this.
116 *
117 * @param action to insert
118 */
119 void insert(IAction action);
120
121 void promoteLinkChangeListener(IAction action);
122
123 void registerLinkChangeListener(ILinkChangeListener listener);
124
125 void removeLinkChangeListener(ILinkChangeListener listener);
126
127 void registerReferenceListener(IReferenceListener listener);
128
129 void removeReferenceListener(IReferenceListener listener);
130
131 /**
132 * Retrieve attribute from Action object.
133 *
134 * @param key
135 * @return value of key
136 */
137 String getAttribute(String key);
138
139 }