• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hazendaz / sitemesh2 / 59

22 Mar 2026 02:30AM UTC coverage: 40.347%. Remained the same
59

push

github

hazendaz
[mvn] Update maven wrapper

698 of 1891 branches covered (36.91%)

Branch coverage included in aggregate %.

1555 of 3693 relevant lines covered (42.11%)

0.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

40.74
/src/main/java/com/opensymphony/module/sitemesh/mapper/DefaultDecorator.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 * Copyright 2011-2026 Hazendaz
4
 */
5
/*
6
 * Title:        DefaultDecorator
7
 * Description:
8
 *
9
 * This software is published under the terms of the OpenSymphony Software
10
 * License version 1.1, of which a copy has been included with this
11
 * distribution in the LICENSE.txt file.
12
 */
13

14
package com.opensymphony.module.sitemesh.mapper;
15

16
import com.opensymphony.module.sitemesh.Decorator;
17

18
import java.util.Collections;
19
import java.util.Iterator;
20
import java.util.Map;
21

22
/**
23
 * Default implementation of Decorator. All properties are set by the constructor.
24
 *
25
 * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
26
 *
27
 * @see com.opensymphony.module.sitemesh.Decorator
28
 */
29
public class DefaultDecorator implements Decorator {
30

31
    /**
32
     * The page.
33
     *
34
     * @see #getPage()
35
     */
36
    protected String page;
37

38
    /**
39
     * The name.
40
     *
41
     * @see #getName()
42
     */
43
    protected String name;
44

45
    /**
46
     * The uri path.
47
     *
48
     * @see #getURIPath()
49
     */
50
    protected String uriPath;
51

52
    /**
53
     * The role.
54
     *
55
     * @see #getRole()
56
     */
57
    protected String role;
58

59
    /**
60
     * The parameters.
61
     *
62
     * @see #getInitParameter(java.lang.String)
63
     */
64
    protected Map<Object, Object> parameters;
65

66
    /**
67
     * Constructor to set name, page and parameters.
68
     *
69
     * @param name
70
     *            the name
71
     * @param page
72
     *            the page
73
     * @param parameters
74
     *            the parameters
75
     */
76
    public DefaultDecorator(String name, String page, Map<Object, Object> parameters) {
77
        this(name, page, null, null, parameters);
×
78
    }
×
79

80
    /**
81
     * Constructor to set all properties.
82
     *
83
     * @param name
84
     *            the name
85
     * @param page
86
     *            the page
87
     * @param uriPath
88
     *            the uri path
89
     * @param parameters
90
     *            the parameters
91
     */
92
    public DefaultDecorator(String name, String page, String uriPath, Map<Object, Object> parameters) {
93
        this(name, page, uriPath, null, parameters);
×
94
    }
×
95

96
    /**
97
     * Constructor to set all properties.
98
     *
99
     * @param name
100
     *            the name
101
     * @param page
102
     *            the page
103
     * @param uriPath
104
     *            the uri path
105
     * @param role
106
     *            the role
107
     * @param parameters
108
     *            the parameters
109
     */
110
    public DefaultDecorator(String name, String page, String uriPath, String role, Map<Object, Object> parameters) {
1✔
111
        this.name = name;
1✔
112
        this.page = page;
1✔
113
        this.uriPath = uriPath;
1✔
114
        this.role = role;
1✔
115
        this.parameters = parameters;
1✔
116
    }
1✔
117

118
    /**
119
     * URI of the Servlet/JSP to dispatch the request to (relative to the web-app context).
120
     */
121
    @Override
122
    public String getPage() {
123
        return page;
1✔
124
    }
125

126
    /** Name of Decorator. For information purposes only. */
127
    @Override
128
    public String getName() {
129
        return name;
1✔
130
    }
131

132
    /** URI path of the Decorator. Enables support for decorators defined in seperate web-apps. */
133
    @Override
134
    public String getURIPath() {
135
        return uriPath;
1✔
136
    }
137

138
    /** Role the user has to be in to get this decorator applied. */
139
    @Override
140
    public String getRole() {
141
        return role;
1✔
142
    }
143

144
    /**
145
     * Returns a String containing the value of the named initialization parameter, or null if the parameter does not
146
     * exist.
147
     *
148
     * @param paramName
149
     *            Key of parameter.
150
     *
151
     * @return Value of parameter or null if not found.
152
     */
153
    @Override
154
    public String getInitParameter(String paramName) {
155
        if (parameters == null || !parameters.containsKey(paramName)) {
×
156
            return null;
×
157
        }
158

159
        return (String) parameters.get(paramName);
×
160
    }
161

162
    /**
163
     * Returns the names of the Decorator's initialization parameters as an Iterator of String objects, or an empty
164
     * Iterator if the Decorator has no initialization parameters.
165
     */
166
    @Override
167
    public Iterator<Object> getInitParameterNames() {
168
        if (parameters == null) {
×
169
            // make sure we always return an empty iterator
170
            return Collections.emptyMap().keySet().iterator();
×
171
        }
172

173
        return parameters.keySet().iterator();
×
174
    }
175
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc