Clover Coverage Report - XWiki Commons - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 17:13:48 CET
../../../../../img/srcFileCovDistChart0.png 69% of files have more coverage
12   90   8   2.4
6   47   0.67   5
5     1.6  
1    
 
  FixedNameEventFilter       Line # 32 12 0% 8 23 0% 0.0
 
No Tests
 
1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.observation.event.filter;
21   
22    import java.io.Serializable;
23   
24    import org.apache.commons.lang3.builder.EqualsBuilder;
25    import org.apache.commons.lang3.builder.HashCodeBuilder;
26   
27    /**
28    * An {@link EventFilter} that matches exactly one document name.
29    *
30    * @version $Id: f4f35862b1741308d13dca7f2c925c9a7063a0b5 $
31    */
 
32    public class FixedNameEventFilter implements EventFilter, Serializable
33    {
34    /**
35    * The version identifier for this Serializable class. Increment only if the <i>serialized</i> form of the class
36    * changes.
37    */
38    private static final long serialVersionUID = 1L;
39   
40    /** The name of the matched document. */
41    private String filter;
42   
43    /**
44    * Constructor initializing this event filter with a document name that should be matched.
45    *
46    * @param filter the name of the matched document
47    */
 
48  0 toggle public FixedNameEventFilter(String filter)
49    {
50  0 this.filter = filter;
51    }
52   
 
53  0 toggle @Override
54    public String getFilter()
55    {
56  0 return this.filter;
57    }
58   
 
59  0 toggle @Override
60    public boolean matches(EventFilter eventFilter)
61    {
62  0 return (getFilter().equals(eventFilter.getFilter()));
63    }
64   
 
65  0 toggle @Override
66    public boolean equals(Object object)
67    {
68  0 if (object == null) {
69  0 return false;
70    }
71  0 if (object == this) {
72  0 return true;
73    }
74  0 if (object.getClass() != getClass()) {
75  0 return false;
76    }
77  0 FixedNameEventFilter rhs = (FixedNameEventFilter) object;
78  0 return new EqualsBuilder()
79    .append(getFilter(), rhs.getFilter())
80    .isEquals();
81    }
82   
 
83  0 toggle @Override
84    public int hashCode()
85    {
86  0 return new HashCodeBuilder(3, 125)
87    .append(getFilter())
88    .toHashCode();
89    }
90    }