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.vfs2.filter;
018
019import java.io.Serializable;
020
021import org.apache.commons.vfs2.FileFilter;
022import org.apache.commons.vfs2.FileSelectInfo;
023
024/**
025 * A file filter that always returns false.
026 *
027 * @author This code was originally ported from Apache Commons IO File Filter
028 * @see "https://commons.apache.org/proper/commons-io/"
029 * @since 2.4
030 */
031public class FalseFileFilter implements FileFilter, Serializable {
032
033    /**
034     * Singleton instance of false filter.
035     *
036     * @since 2.10.0
037     */
038    public static final FileFilter INSTANCE = new FalseFileFilter();
039
040    /**
041     * Singleton instance of false filter.
042     * @deprecated Use {@link #INSTANCE}.
043     */
044    @Deprecated
045    public static final FileFilter FALSE = INSTANCE;
046
047    private static final long serialVersionUID = 1L;
048
049    /**
050     * Restrictive constructor.
051     */
052    protected FalseFileFilter() {
053    }
054
055    /**
056     * Returns false.
057     *
058     * @param fileSelectInfo the file to check (ignored)
059     * @return Always {@code false}
060     */
061    @Override
062    public boolean accept(final FileSelectInfo fileSelectInfo) {
063        return false;
064    }
065
066}