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 true. 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 TrueFileFilter implements FileFilter, Serializable { 032 033 /** 034 * Singleton instance of true filter. 035 * 036 * @since 2.10.0 037 */ 038 public static final FileFilter INSTANCE = new TrueFileFilter(); 039 040 private static final long serialVersionUID = 1L; 041 042 /** 043 * Singleton instance of true filter. 044 * 045 * @deprecated Use {@link #INSTANCE}. 046 */ 047 @Deprecated 048 public static final FileFilter TRUE = INSTANCE; 049 050 /** 051 * Restrictive constructor. 052 */ 053 protected TrueFileFilter() { 054 } 055 056 /** 057 * Returns true. 058 * 059 * @param fileSelectInfo the file to check (ignored) 060 * @return Always {@code true} 061 */ 062 @Override 063 public boolean accept(final FileSelectInfo fileSelectInfo) { 064 return true; 065 } 066 067}