Class FilePath
- java.lang.Object
-
- com.perforce.p4java.impl.generic.core.file.FilePath
-
public class FilePath extends java.lang.Object
Defines a file spec path for Perforce IFileSpec objects, and a bunch of useful methods for extracting and appending Perforce file-related metadata (such as revision information or label / changelist / date annotations) to and from paths and path strings. In Perforce terms, a file path specifies a particular file, but not a specific revision of that file (either implicitly or explicitly). That is, FilePath objects do not contain the possible "#" or "@" (etc.) specifiers suffixed to Perforce paths. In P4Java terms, file path strings are typically string representations of paths as understood above, but with version / changelist / etc. annotations attached.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FilePath.PathType
Defines the various types a Perforce file path can have.
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
pathString
protected FilePath.PathType
pathType
-
Constructor Summary
Constructors Constructor Description FilePath()
Default constructor -- sets path type field to UNKNOWN, path string to null.FilePath(FilePath.PathType pathType, java.lang.String pathString)
Construct a FilePath from explicit type and path string values.FilePath(FilePath.PathType pathType, java.lang.String pathString, boolean ignoreAnnotations)
Construct a FilePath from explicit type and path string values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
annotate(IFileSpec fileSpec)
java.lang.String
annotate(PathAnnotations annotations)
Annotate this path with the passed-in Perforce file metadata annotations.java.lang.String
getPathString()
FilePath.PathType
getPathType()
void
setPathString(java.lang.String pathString)
void
setPathType(FilePath.PathType pathType)
java.lang.String
toString()
Note: does NOT annotate by default!
-
-
-
Field Detail
-
pathString
protected java.lang.String pathString
-
pathType
protected FilePath.PathType pathType
-
-
Constructor Detail
-
FilePath
public FilePath()
Default constructor -- sets path type field to UNKNOWN, path string to null.
-
FilePath
public FilePath(FilePath.PathType pathType, java.lang.String pathString)
Construct a FilePath from explicit type and path string values. If the passed-in pathString contains version / date / changelist information, it is stripped from the path and ignored.- Parameters:
pathType
- pathTypepathString
- pathString
-
FilePath
public FilePath(FilePath.PathType pathType, java.lang.String pathString, boolean ignoreAnnotations)
Construct a FilePath from explicit type and path string values. If the ignoreAnnotations parameter is false and if the passed-in pathString contains version / date / changelist information, it is stripped from the path and ignored; otherwise the pathString parameter is used-as is (allowing for embedded "#" and "@" characters, for instance).- Parameters:
pathType
- pathTypepathString
- pathStringignoreAnnotations
- ignoreAnnotations
-
-
Method Detail
-
annotate
public java.lang.String annotate(PathAnnotations annotations)
Annotate this path with the passed-in Perforce file metadata annotations. If either or both this.pathString and annotations is null, returns this.pathString.- Parameters:
annotations
- annotations- Returns:
- path string
-
annotate
public java.lang.String annotate(IFileSpec fileSpec)
- Parameters:
fileSpec
- file spec- Returns:
- annotated path string
-
getPathType
public FilePath.PathType getPathType()
-
toString
public java.lang.String toString()
Note: does NOT annotate by default!- Overrides:
toString
in classjava.lang.Object
-
getPathString
public java.lang.String getPathString()
-
setPathString
public void setPathString(java.lang.String pathString)
-
setPathType
public void setPathType(FilePath.PathType pathType)
-
-