• 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

0.0
/src/main/java/com/opensymphony/module/sitemesh/taglib/decorator/PropertyTag.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 * Copyright 2011-2026 Hazendaz
4
 */
5
/*
6
 * Title:        PropertyTag
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.taglib.decorator;
15

16
import com.opensymphony.module.sitemesh.Page;
17
import com.opensymphony.module.sitemesh.taglib.AbstractTag;
18

19
import java.io.Writer;
20

21
/**
22
 * Write property of Page to out.
23
 *
24
 * @author <a href="joe@truemesh.com">Joe Walnes</a>
25
 *
26
 * @see com.opensymphony.module.sitemesh.Page#getProperty(java.lang.String)
27
 */
28
public class PropertyTag extends AbstractTag {
×
29

30
    /** The Constant serialVersionUID. */
31
    private static final long serialVersionUID = 1L;
32

33
    /** The default value. */
34
    private String propertyName, defaultValue;
35

36
    /** The write entire property. */
37
    private boolean writeEntireProperty = false;
×
38

39
    /**
40
     * Key of property to write.
41
     *
42
     * @param propertyName
43
     *            the new property
44
     */
45
    public void setProperty(String propertyName) {
46
        this.propertyName = propertyName;
×
47
    }
×
48

49
    /**
50
     * Gets the property.
51
     *
52
     * @return the property
53
     */
54
    protected String getProperty() {
55
        return propertyName;
×
56
    }
57

58
    /**
59
     * Value to write if no property matching key is found (optional).
60
     *
61
     * @param defaultValue
62
     *            the new default
63
     */
64
    public void setDefault(String defaultValue) {
65
        this.defaultValue = defaultValue;
×
66
    }
×
67

68
    /**
69
     * When begins with y, t or 1, the full attribute (name + value) is written.
70
     *
71
     * @param writeEntireProperty
72
     *            the new write entire property
73
     */
74
    public final void setWriteEntireProperty(String writeEntireProperty) {
75
        if (writeEntireProperty == null || writeEntireProperty.trim().length() == 0) {
×
76
            return;
×
77
        }
78

79
        switch (writeEntireProperty.charAt(0)) {
×
80
            case '1':
81
            case 't':
82
            case 'T':
83
            case 'y':
84
            case 'Y':
85
                this.writeEntireProperty = true;
×
86
                break;
×
87
            default:
88
                this.writeEntireProperty = false;
×
89
        }
90
    }
×
91

92
    @Override
93
    public int doEndTag() {
94
        try {
95
            Page page = getPage();
×
96
            String propertyValue = page.getProperty(propertyName);
×
97

98
            if (propertyValue == null || propertyValue.trim().length() == 0) {
×
99
                propertyValue = defaultValue;
×
100
            }
101

102
            if (propertyValue != null) {
×
103
                Writer out = getOut();
×
104
                if (writeEntireProperty) {
×
105
                    out.write(" ");
×
106
                    out.write(propertyName.substring(propertyName.lastIndexOf('.') + 1));
×
107
                    out.write("=\"");
×
108
                    out.write(propertyValue);
×
109
                    out.write("\"");
×
110
                } else {
111
                    out.write(propertyValue);
×
112
                }
113
            }
114
        } catch (Exception e) {
×
115
            trace(e);
×
116
        }
×
117
        return EVAL_PAGE;
×
118
    }
119

120
}
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