com.perforce.p4java.core.file
Class FileSpecBuilder

java.lang.Object
  extended by com.perforce.p4java.core.file.FileSpecBuilder

public class FileSpecBuilder
extends Object

A class used to provide generally-useful Perforce filespec-related static methods.


Constructor Summary
FileSpecBuilder()
           
 
Method Summary
static List<IFileSpec> getInvalidFileSpecs(List<IFileSpec> fileSpecs)
          Given a list of file specs, return a list of the invalid file specs in that list.
static List<IFileSpec> getValidFileSpecs(List<IFileSpec> fileSpecs)
          Given a list of file specs, return a list of the valid file specs in that list.
static List<IFileSpec> makeFileSpecList(List<String> pathList)
          Given a list of file paths (which might include revision or label specs, etc.), return a corresponding list of file specs.
static List<IFileSpec> makeFileSpecList(String path)
          Create a list containing a single file spec created from the specified path.
static List<IFileSpec> makeFileSpecList(String[] pathArray)
          Given an array of file paths (which might include revision or label specs, etc.), return a corresponding list of file specs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSpecBuilder

public FileSpecBuilder()
Method Detail

makeFileSpecList

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

Parameters:
pathList - list of path strings
Returns:
possibly-null (or empty) list of filespecs

makeFileSpecList

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

NOTE: use the 'FileSpecBuilder.makeFileSpecList(List 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:
pathArray - array of path strings
Returns:
possibly-null (or empty) list of filespecs

makeFileSpecList

public static List<IFileSpec> makeFileSpecList(String path)
Create a list containing a single file spec created from the specified path.

Parameters:
path -
Returns:
non-null but possibly empty list of filespecs

getValidFileSpecs

public static List<IFileSpec> getValidFileSpecs(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 List<IFileSpec> getInvalidFileSpecs(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


Copyright © 2015 Perforce Software. All Rights Reserved.