    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 *
    027 *
    028 * @see FileFilterUtils#falseFileFilter()
    029 */
    030public class FalseFileFilter implements IOFileFilter, Serializable {
    031
    032    private static final long serialVersionUID = 6210271677940926200L;
    033    /**
    034     * Singleton instance of false filter.
    035     * @since 1.3
    036     */
    037    public static final IOFileFilter FALSE = new FalseFileFilter();
    038    /**
    039     * Singleton instance of false filter.
    040     * Please use the identical FalseFileFilter.FALSE constant.
    041     * The new name is more JDK 1.5 friendly as it doesn't clash with other
    042     * values when using static imports.
    043     */
    044    public static final IOFileFilter INSTANCE = FALSE;
    045
    046    /**
    047     * Restrictive constructor.
    048     */
    049    protected FalseFileFilter() {
    050    }
    051
    052    /**
    053     * Returns false.
    054     *
    055     * @param file  the file to check (ignored)
    056     * @return false
    057     */
    058    @Override
    059    public boolean accept(final File file) {
    060        return false;
    061    }
    062
    063    /**
    064     * Returns false.
    065     *
    066     * @param dir  the directory to check (ignored)
    067     * @param name  the file name (ignored)
    068     * @return false
    069     */
    070    @Override
    071    public boolean accept(final File dir, final String name) {
    072        return false;
    073    }
    074
    075}