Class FileSpecBuilder


  • public class FileSpecBuilder
    extends java.lang.Object
    A class used to provide generally-useful Perforce filespec-related static methods.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<IFileSpec> getInvalidFileSpecs​(java.util.List<IFileSpec> fileSpecs)
      Given a list of file specs, return a list of the invalid file specs in that list.
      static java.util.List<IFileSpec> getValidFileSpecs​(java.util.List<IFileSpec> fileSpecs)
      Given a list of file specs, return a list of the valid file specs in that list.
      static java.util.List<IFileSpec> makeFileSpecList​(java.lang.String... filePaths)
      Given an array of file paths (which might include revision or label specs, etc.), return a corresponding list of file specs.
      static java.util.List<IFileSpec> makeFileSpecList​(java.util.List<java.lang.String> filePaths)
      Given a list of file paths (which might include revision or label specs, etc.), return a corresponding list of file specs.
      static java.util.List<IFileSpec> makeFileSpecListSpecialChars​(java.lang.String... filePaths)
      Given a list of file paths which include special characters like #, @, % or * in the file path, replaces the special characters (%, @, # or *) with their numeric values and returns a corresponding list of file specs.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • makeFileSpecList

        public static java.util.List<IFileSpec> makeFileSpecList​(@Nullable
                                                                 java.util.List<java.lang.String> filePaths)
        Given a list of file paths (which might include revision or label specs, etc.), return a corresponding list of file specs. Returns null if filePaths is null; skips any null element of the list.
        Parameters:
        filePaths - list of path strings
        Returns:
        non-null list of filespecs
      • makeFileSpecList

        public static java.util.List<IFileSpec> makeFileSpecList​(java.lang.String... filePaths)
        Given an array of file paths (which might include revision or label specs, etc.), return a corresponding list of file specs. Returns null if filePaths is null; skips any null element of the array.

        NOTE: use the 'FileSpecBuilder.makeFileSpecList(List<String> pathList)' method if you have a very large amount of file paths. The method with the 'List' parameter is more memory efficient, since an array keeps data in a contiguous chunk of memory.

        Parameters:
        filePaths - array of path strings
        Returns:
        non-null list of filespecs
      • makeFileSpecListSpecialChars

        public static java.util.List<IFileSpec> makeFileSpecListSpecialChars​(java.lang.String... filePaths)
        Given a list of file paths which include special characters like #, @, % or * in the file path, replaces the special characters (%, @, # or *) with their numeric values and returns a corresponding list of file specs.
        Parameters:
        filePaths - multiple file path strings
        Returns:
        non-null list of filespecs
      • getValidFileSpecs

        public static java.util.List<IFileSpec> getValidFileSpecs​(@Nullable
                                                                  java.util.List<IFileSpec> fileSpecs)
        Given a list of file specs, return a list of the valid file specs in that list. "Valid" here means a) non-null, and b) getOpStatus() returns VALID.
        Parameters:
        fileSpecs - candidate file specs
        Returns:
        non-null but possibly-empty list of valid file specs
      • getInvalidFileSpecs

        public static java.util.List<IFileSpec> getInvalidFileSpecs​(@Nullable
                                                                    java.util.List<IFileSpec> fileSpecs)
        Given a list of file specs, return a list of the invalid file specs in that list. "Invalid" here means a) non-null, and b) getOpStatus() returns anything but VALID.
        Parameters:
        fileSpecs - candidate file specs
        Returns:
        non-null but possibly-empty list of invalid file specs