1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.project.validation;
20
21 import java.util.ArrayList;
22 import java.util.Collections;
23 import java.util.List;
24
25
26
27 @Deprecated
28 public class ModelValidationResult {
29
30
31 private static final String LS = System.lineSeparator();
32
33
34 private List<String> messages;
35
36 public ModelValidationResult() {
37 messages = new ArrayList<>();
38 }
39
40 public int getMessageCount() {
41 return messages.size();
42 }
43
44 public String getMessage(int i) {
45 return messages.get(i);
46 }
47
48 public List<String> getMessages() {
49 return Collections.unmodifiableList(messages);
50 }
51
52 public void addMessage(String message) {
53 messages.add(message);
54 }
55
56 public String toString() {
57 return render("");
58 }
59
60 public String render(String indentation) {
61 if (messages.size() == 0) {
62 return indentation + "There were no validation errors.";
63 }
64
65 StringBuilder message = new StringBuilder();
66
67
68
69
70
71
72
73
74
75
76 for (int i = 0; i < messages.size(); i++) {
77 message.append(indentation)
78 .append('[')
79 .append(i)
80 .append("] ")
81 .append(messages.get(i))
82 .append(LS);
83 }
84
85 return message.toString();
86 }
87 }