Coverage Report - org.jtheque.films.services.impl.utils.file.jt.JTFileFilter
 
Classes in this File Line Coverage Branch Coverage Complexity
JTFileFilter
0 %
0/4
0 %
0/2
1
 
 1  
 package org.jtheque.films.services.impl.utils.file.jt;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque 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
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jtheque.films.utils.Constants.Files.FileType;
 20  
 import org.jtheque.utils.io.SimpleFilter;
 21  
 
 22  
 /**
 23  
  * A File Filter for a certain type of file.
 24  
  *
 25  
  * @author Baptiste Wicht
 26  
  */
 27  
 public final class JTFileFilter extends SimpleFilter {
 28  
     private final FileType fileType;
 29  
 
 30  
     /**
 31  
      * Construct a new JTFileFilter with a description, an extension and a file type.
 32  
      *
 33  
      * @param description The description of the file filter.
 34  
      * @param extensions  The extensions accepted by the filter.
 35  
      * @param fileType    The type of file this filter filter.
 36  
      */
 37  
     public JTFileFilter(String description, String extensions, FileType fileType) {
 38  0
         super(description, extensions);
 39  
 
 40  0
         this.fileType = fileType;
 41  0
     }
 42  
 
 43  
     /**
 44  
      * Indicate if this filter can filter a certain type of file.
 45  
      *
 46  
      * @param fileType The file type we must test if this filter can filter.
 47  
      * @return <code>true</code> if it can filter this type else <code>false</code>.
 48  
      */
 49  
     public boolean canFilter(FileType fileType) {
 50  0
         return fileType == this.fileType;
 51  
     }
 52  
 }