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; 018 019/** 020 * Several standard file selectors. 021 */ 022public final class Selectors { 023 024 /** 025 * A {@link FileSelector} that selects only the base file/folder. 026 */ 027 public static final FileSelector SELECT_SELF = new FileDepthSelector(); 028 029 /** 030 * A {@link FileSelector} that selects the base file/folder and its direct children. 031 */ 032 public static final FileSelector SELECT_SELF_AND_CHILDREN = new FileDepthSelector(0, 1); 033 034 /** 035 * A {@link FileSelector} that selects only the direct children of the base folder. 036 */ 037 public static final FileSelector SELECT_CHILDREN = new FileDepthSelector(1); 038 039 /** 040 * A {@link FileSelector} that selects all the descendants of the base folder, but does not select the base folder 041 * itself. 042 */ 043 public static final FileSelector EXCLUDE_SELF = new FileDepthSelector(1, Integer.MAX_VALUE); 044 045 /** 046 * A {@link FileSelector} that only files (not folders). 047 */ 048 public static final FileSelector SELECT_FILES = new FileTypeSelector(FileType.FILE); 049 050 /** 051 * A {@link FileSelector} that only folders (not files). 052 */ 053 public static final FileSelector SELECT_FOLDERS = new FileTypeSelector(FileType.FOLDER); 054 055 /** 056 * A {@link FileSelector} that selects the base file/folder, plus all its descendants. 057 */ 058 public static final FileSelector SELECT_ALL = new AllFileSelector(); 059 060 /** 061 * Prevents the class from being instantiated. 062 */ 063 private Selectors() { 064 } 065}