1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.observation.event.filter

File FixedNameEventFilter.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

6
12
5
1
89
43
8
0.67
2.4
5
1.6

Classes

Class Line # Actions
FixedNameEventFilter 32 12 0% 8 0
1.0100%
 

Contributing tests

This file is covered by 142 tests. .

Source view

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    import java.util.Objects;
24   
25    import org.apache.commons.lang3.builder.HashCodeBuilder;
26   
27    /**
28    * An {@link EventFilter} that matches exactly one document name.
29    *
30    * @version $Id: dd02e6ec542f0aec1cffcda7b0c4a503795cfd4f $
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  26869 toggle public FixedNameEventFilter(String filter)
49    {
50  26869 this.filter = filter;
51    }
52   
 
53  8634 toggle @Override
54    public String getFilter()
55    {
56  8634 return this.filter;
57    }
58   
 
59  3975 toggle @Override
60    public boolean matches(EventFilter eventFilter)
61    {
62  3975 return (getFilter().equals(eventFilter.getFilter()));
63    }
64   
 
65  52 toggle @Override
66    public boolean equals(Object object)
67    {
68  52 if (object == null) {
69  1 return false;
70    }
71   
72  51 if (object == this) {
73  1 return true;
74    }
75   
76  50 if (object.getClass() != getClass()) {
77  1 return false;
78    }
79   
80  49 FixedNameEventFilter rhs = (FixedNameEventFilter) object;
81  49 return Objects.equals(getFilter(), rhs.getFilter());
82    }
83   
 
84  51 toggle @Override
85    public int hashCode()
86    {
87  51 return new HashCodeBuilder(3, 125).append(getFilter()).toHashCode();
88    }
89    }