• 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

88.89
/src/main/java/com/opensymphony/module/sitemesh/html/BasicRule.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 * Copyright 2011-2026 Hazendaz
4
 */
5
package com.opensymphony.module.sitemesh.html;
6

7
import com.opensymphony.module.sitemesh.SitemeshBufferFragment;
8

9
/**
10
 * The Class BasicRule.
11
 */
12
public abstract class BasicRule implements TagRule {
13

14
    /** The acceptable tag names. */
15
    private final String[] acceptableTagNames;
16

17
    /** The context. */
18
    protected HTMLProcessorContext context;
19

20
    /**
21
     * Instantiates a new basic rule.
22
     *
23
     * @param acceptableTagNames
24
     *            the acceptable tag names
25
     */
26
    protected BasicRule(String[] acceptableTagNames) {
1✔
27
        this.acceptableTagNames = acceptableTagNames;
1✔
28
    }
1✔
29

30
    /**
31
     * Instantiates a new basic rule.
32
     *
33
     * @param acceptableTagName
34
     *            the acceptable tag name
35
     */
36
    protected BasicRule(String acceptableTagName) {
1✔
37
        this.acceptableTagNames = new String[] { acceptableTagName };
1✔
38
    }
1✔
39

40
    /**
41
     * Instantiates a new basic rule.
42
     */
43
    protected BasicRule() {
1✔
44
        this.acceptableTagNames = null;
1✔
45
    }
1✔
46

47
    @Override
48
    public void setContext(HTMLProcessorContext context) {
49
        this.context = context;
1✔
50
    }
1✔
51

52
    @Override
53
    public boolean shouldProcess(String name) {
54
        if (acceptableTagNames == null || acceptableTagNames.length < 1) {
1!
55
            throw new UnsupportedOperationException(getClass().getName()
×
56
                    + " should be constructed with acceptableTagNames OR should implement shouldProcess()");
57
        }
58

59
        for (String acceptableTagName : acceptableTagNames) {
1✔
60
            if (name.equals(acceptableTagName)) {
1✔
61
                return true;
1✔
62
            }
63
        }
64
        return false;
1✔
65
    }
66

67
    /**
68
     * Current buffer.
69
     *
70
     * @return the sitemesh buffer fragment. builder
71
     */
72
    protected SitemeshBufferFragment.Builder currentBuffer() {
73
        return context.currentBuffer();
1✔
74
    }
75

76
    /**
77
     * Gets the current buffer content.
78
     *
79
     * @return the current buffer content
80
     */
81
    protected String getCurrentBufferContent() {
82
        return context.currentBuffer().build().getStringContent();
1✔
83
    }
84

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