001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 * 
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 * 
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.io.filefilter;
018
019import java.io.File;
020import java.io.Serializable;
021
022/**
023 * A file filter that always returns false.
024 *
025 * @since 1.0
026 * @version $Id: FalseFileFilter.java 1304058 2012-03-22 21:02:43Z sebb $
027 *
028 * @see FileFilterUtils#falseFileFilter()
029 */
030public class FalseFileFilter implements IOFileFilter, Serializable {
031
032    /**
033     * Singleton instance of false filter.
034     * @since 1.3
035     */
036    public static final IOFileFilter FALSE = new FalseFileFilter();
037    /**
038     * Singleton instance of false filter.
039     * Please use the identical FalseFileFilter.FALSE constant.
040     * The new name is more JDK 1.5 friendly as it doesn't clash with other
041     * values when using static imports.
042     */
043    public static final IOFileFilter INSTANCE = FALSE;
044
045    /**
046     * Restrictive consructor.
047     */
048    protected FalseFileFilter() {
049    }
050
051    /**
052     * Returns false.
053     *
054     * @param file  the file to check (ignored)
055     * @return false
056     */
057    public boolean accept(File file) {
058        return false;
059    }
060
061    /**
062     * Returns false.
063     *
064     * @param dir  the directory to check (ignored)
065     * @param name  the filename (ignored)
066     * @return false
067     */
068    public boolean accept(File dir, String name) {
069        return false;
070    }
071
072}