View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.vfs2;
18  
19  /**
20   * Several standard file selectors.
21   */
22  public final class Selectors {
23  
24      /**
25       * A {@link FileSelector} that selects only the base file/folder.
26       */
27      public static final FileSelector SELECT_SELF = new FileDepthSelector();
28  
29      /**
30       * A {@link FileSelector} that selects the base file/folder and its direct children.
31       */
32      public static final FileSelector SELECT_SELF_AND_CHILDREN = new FileDepthSelector(0, 1);
33  
34      /**
35       * A {@link FileSelector} that selects only the direct children of the base folder.
36       */
37      public static final FileSelector SELECT_CHILDREN = new FileDepthSelector(1);
38  
39      /**
40       * A {@link FileSelector} that selects all the descendants of the base folder, but does not select the base folder
41       * itself.
42       */
43      public static final FileSelector EXCLUDE_SELF = new FileDepthSelector(1, Integer.MAX_VALUE);
44  
45      /**
46       * A {@link FileSelector} that only files (not folders).
47       */
48      public static final FileSelector SELECT_FILES = new FileTypeSelector(FileType.FILE);
49  
50      /**
51       * A {@link FileSelector} that only folders (not files).
52       */
53      public static final FileSelector SELECT_FOLDERS = new FileTypeSelector(FileType.FOLDER);
54  
55      /**
56       * A {@link FileSelector} that selects the base file/folder, plus all its descendants.
57       */
58      public static final FileSelector SELECT_ALL = new AllFileSelector();
59  
60      /**
61       * Prevents the class from being instantiated.
62       */
63      private Selectors() {
64      }
65  }