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

hazendaz / displaytag / 1753

12 Feb 2026 03:17AM UTC coverage: 77.321% (-0.01%) from 77.334%
1753

push

github

web-flow
Merge pull request #1102 from hazendaz/renovate/javax-support-logback-monorepo

Update dependency ch.qos.logback:logback-classic to v1.5.29 (javax-support)

1438 of 2003 branches covered (71.79%)

Branch coverage included in aggregate %.

4034 of 5074 relevant lines covered (79.5%)

0.8 hits per line

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

68.57
/displaytag/src/main/java/org/displaytag/model/Cell.java
1
/*
2
 * SPDX-License-Identifier: MIT
3
 * See LICENSE file for details.
4
 *
5
 * Copyright 2002-2026 Fabrizio Giustina, the Displaytag team
6
 */
7
package org.displaytag.model;
8

9
import java.text.Collator;
10

11
import org.apache.commons.lang3.builder.ToStringBuilder;
12
import org.apache.commons.lang3.builder.ToStringStyle;
13
import org.displaytag.util.HtmlAttributeMap;
14

15
/**
16
 * Represents a table cell.
17
 * <p>
18
 * A cell is used only when the content is placed as content of the column tag and need to be evaluated during
19
 * iteration.
20
 */
21
public class Cell implements Comparable<Cell> {
22

23
    /**
24
     * empty cell object. Use as placeholder for empty cell to avoid useless object creation.
25
     */
26
    public static final Cell EMPTY_CELL = new Cell();
1✔
27

28
    /**
29
     * content of the cell.
30
     */
31
    private Object staticValue;
32

33
    /**
34
     * Per row html attributes (style, class).
35
     */
36
    private HtmlAttributeMap attributes;
37

38
    /**
39
     * Creates a new empty cell. This should never be done, use EMPTY_CELL instead.
40
     */
41
    private Cell() {
42
    }
43

44
    /**
45
     * Creates a cell with a static value.
46
     *
47
     * @param value
48
     *            Object value of the Cell object
49
     */
50
    public Cell(final Object value) {
1✔
51
        this.staticValue = value;
1✔
52
    }
1✔
53

54
    /**
55
     * get the static value for the cell.
56
     *
57
     * @return the Object value of this.staticValue.
58
     */
59
    public Object getStaticValue() {
60
        return this.staticValue;
1✔
61
    }
62

63
    /**
64
     * Compare the Cell value to another Cell.
65
     *
66
     * @param obj
67
     *            Object to compare this cell to
68
     * @param collator
69
     *            Collator to use for the comparison of the other object is a Cell holding a String
70
     *
71
     * @return int
72
     *
73
     * @see java.lang.Comparable#compareTo(Object)
74
     */
75
    public int compareTo(final Object obj, final Collator collator) {
76
        if (this.staticValue == null) {
1!
77
            return -1;
×
78
        }
79
        if (obj instanceof Cell) {
1!
80
            final Object otherStatic = ((Cell) obj).getStaticValue();
1✔
81
            if (otherStatic == null) {
1!
82
                return 1;
×
83
            }
84
            if (collator != null && this.staticValue instanceof String && otherStatic instanceof String) {
1!
85
                final String a = (String) this.staticValue;
1✔
86
                final String b = (String) otherStatic;
1✔
87
                return collator.compare(a, b);
1✔
88
            }
89
            return ((Comparable<Object>) this.staticValue).compareTo(otherStatic);
×
90
        }
91
        return ((Comparable<Object>) this.staticValue).compareTo(obj);
×
92
    }
93

94
    /**
95
     * Compare the Cell value to another Cell.
96
     *
97
     * @param obj
98
     *            Object to compare this cell to
99
     *
100
     * @return int
101
     *
102
     * @see java.lang.Comparable#compareTo(Object)
103
     */
104
    @Override
105
    public int compareTo(final Cell obj) {
106
        return this.compareTo(obj, null);
×
107
    }
108

109
    /**
110
     * Simple toString which output the static value.
111
     *
112
     * @return String representation of the cell
113
     */
114
    @Override
115
    public String toString() {
116
        return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) //
1✔
117
                .append("staticValue", this.staticValue).toString(); //$NON-NLS-1$
1✔
118
    }
119

120
    /**
121
     * Sets the per row attributes.
122
     *
123
     * @param perRowValues
124
     *            the new per row attributes
125
     */
126
    public void setPerRowAttributes(final HtmlAttributeMap perRowValues) {
127
        this.attributes = perRowValues;
1✔
128
    }
1✔
129

130
    /**
131
     * Gets the per row attributes.
132
     *
133
     * @return the per row attributes
134
     */
135
    public HtmlAttributeMap getPerRowAttributes() {
136
        return this.attributes;
1✔
137
    }
138

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