1 package org.codehaus.plexus.interpolation.fixed;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import java.util.ArrayList;
20 import java.util.HashSet;
21 import java.util.List;
22 import java.util.Set;
23
24 import org.codehaus.plexus.interpolation.RecursionInterceptor;
25 import org.codehaus.plexus.interpolation.SimpleRecursionInterceptor;
26
27
28
29
30
31 public class InterpolationState {
32 private final List<String> messages = new ArrayList<String>();
33 private final List<Throwable> causes = new ArrayList<Throwable>();
34
35 public void addFeedback(String message, Throwable cause) {
36 messages.add(message);
37 causes.add(cause);
38 }
39
40 public List asList() {
41 ArrayList<Object> items = new ArrayList<Object>();
42 for (int i = 0; i < messages.size(); i++) {
43 String msg = messages.get(i);
44 if (msg != null) items.add(msg);
45 Throwable cause = causes.get(i);
46 if (cause != null) items.add(cause);
47 }
48 return items.size() > 0 ? items : null;
49 }
50
51 public void clear() {
52 messages.clear();
53 causes.clear();
54 unresolvable.clear();
55 recursionInterceptor.clear();
56 root = null;
57 }
58
59 final Set<String> unresolvable = new HashSet<String>();
60 RecursionInterceptor recursionInterceptor = new SimpleRecursionInterceptor();
61
62 public void setRecursionInterceptor(RecursionInterceptor recursionInterceptor) {
63 this.recursionInterceptor = recursionInterceptor;
64 }
65
66 FixedStringSearchInterpolator root = null;
67 }