Skip to content

Package: ValidationMessage

ValidationMessage

nameinstructionbranchcomplexitylinemethod
ValidationMessage(String, String)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getId()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getMessage()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 1997, 2020 Oracle and/or its affiliates and others.
3: * All rights reserved.
4: * Copyright 2004 The Apache Software Foundation
5: *
6: * Licensed under the Apache License, Version 2.0 (the "License");
7: * you may not use this file except in compliance with the License.
8: * You may obtain a copy of the License at
9: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: package jakarta.servlet.jsp.tagext;
20:
21: /**
22: * A validation message from either TagLibraryValidator or TagExtraInfo.
23: * <p>
24: * As of JSP 2.0, a JSP container must support a jsp:id attribute to provide higher quality validation errors. The
25: * container will track the JSP pages as passed to the container, and will assign to each element a unique "id", which
26: * is passed as the value of the jsp:id attribute. Each XML element in the XML view available will be extended with this
27: * attribute. The TagLibraryValidator can then use the attribute in one or more ValidationMessage objects. The container
28: * then, in turn, can use these values to provide more precise information on the location of an error.
29: *
30: * <p>
31: * The actual prefix of the <code>id</code> attribute may or may not be <code>jsp</code> but it will always map to the
32: * namespace <code>http://java.sun.com/JSP/Page</code>. A TagLibraryValidator implementation must rely on the uri, not
33: * the prefix, of the <code>id</code> attribute.
34: */
35: public class ValidationMessage {
36:
37: /**
38: * Create a ValidationMessage. The message String should be non-null. The value of id may be null, if the message is
39: * not specific to any XML element, or if no jsp:id attributes were passed on. If non-null, the value of id must be
40: * the value of a jsp:id attribute for the PageData passed into the validate() method.
41: *
42: * @param id Either null, or the value of a jsp:id attribute.
43: * @param message A localized validation message.
44: */
45: public ValidationMessage(String id, String message) {
46: this.id = id;
47: this.message = message;
48: }
49:
50: /**
51: * Get the jsp:id. Null means that there is no information available.
52: *
53: * @return The jsp:id information.
54: */
55: public String getId() {
56: return id;
57: }
58:
59: /**
60: * Get the localized validation message.
61: *
62: * @return A validation message
63: */
64: public String getMessage() {
65: return message;
66: }
67:
68: // Private data
69: private String id;
70: private String message;
71: }