Class FileAnnotation
- java.lang.Object
-
- com.perforce.p4java.impl.generic.core.file.FileAnnotation
-
- All Implemented Interfaces:
IFileAnnotation
public class FileAnnotation extends java.lang.Object implements IFileAnnotation
Simple generic implementation class for IFileAnnotation interface.
-
-
Constructor Summary
Constructors Constructor Description FileAnnotation(int upper, int lower, java.lang.String depotPath, java.lang.String line, IClientSummary.ClientLineEnd lineEnd)
Default all-field constructor.FileAnnotation(int order, java.lang.String depotPath, int upper, int lower)
Create a new non-data file annotation with the passed-in parameters.FileAnnotation(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.String depotPath, IClientSummary.ClientLineEnd lineEnd)
Construct a suitable FileAnnotation object from the passed-in map; this map must be in the format and use the fields returned from a Perforce server annotate command.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addIntegrationAnnotation(IFileAnnotation annotation)
Add an integration annotation to the contributingSources list.java.util.List<IFileAnnotation>
getAllIntegrations()
Get a list of all contributing integration annotations for this annotation, if such a list exists.java.lang.String
getDepotPath()
java.lang.String
getLine()
java.lang.String
getLine(boolean processLineEndings)
IClientSummary.ClientLineEnd
getLineEnd()
int
getLower()
int
getOrdering()
int
getUpper()
void
setDepotPath(java.lang.String depotPath)
void
setLine(java.lang.String line)
void
setLineEnd(IClientSummary.ClientLineEnd lineEnd)
void
setLower(int lower)
FileAnnotation
setOrdering(int ordering)
void
setUpper(int upper)
-
-
-
Constructor Detail
-
FileAnnotation
public FileAnnotation(int upper, int lower, java.lang.String depotPath, java.lang.String line, IClientSummary.ClientLineEnd lineEnd)
Default all-field constructor.- Parameters:
upper
- upperlower
- lowerdepotPath
- depotPathline
- linelineEnd
- lineEnd
-
FileAnnotation
public FileAnnotation(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.String depotPath, IClientSummary.ClientLineEnd lineEnd)
Construct a suitable FileAnnotation object from the passed-in map; this map must be in the format and use the fields returned from a Perforce server annotate command.Leave lineEnd null for normal use.
- Parameters:
map
- mapdepotPath
- depotPathlineEnd
- lineEnd
-
FileAnnotation
public FileAnnotation(int order, java.lang.String depotPath, int upper, int lower)
Create a new non-data file annotation with the passed-in parameters.- Parameters:
order
- orderdepotPath
- depotPathupper
- upperlower
- lower
-
-
Method Detail
-
addIntegrationAnnotation
public void addIntegrationAnnotation(IFileAnnotation annotation)
Add an integration annotation to the contributingSources list. If the list is null, a new list will be created; otherwise it's added to the end of the list.- Parameters:
annotation
- annotation
-
getDepotPath
public java.lang.String getDepotPath()
- Specified by:
getDepotPath
in interfaceIFileAnnotation
- Returns:
- the associated depot path for this annotation, if one is available. May be null in certain (very unusual) circumstances.
- See Also:
IFileAnnotation.getDepotPath()
-
getLine
public java.lang.String getLine()
- Specified by:
getLine
in interfaceIFileAnnotation
- Returns:
- the line being annotated. This will not include the associated newline
character or any line ending processing, but may include any embedded carriage
return characters if they exist.
The returned line will never be null, but may be empty.
- See Also:
IFileAnnotation.getLine()
-
getLine
public java.lang.String getLine(boolean processLineEndings)
- Specified by:
getLine
in interfaceIFileAnnotation
- Parameters:
processLineEndings
- if true, and if a client is associated with this annotation (i.e. it was created by one of the IServer or IFileSpec annotation methods, and a client was associated with the server at the time the IServer or IFileSpec call was made), the returned string will attempt to honor client line end settings where possible; if there are no available settings, the local line ending is appended. If processLineEndings is not true, the results are identical to calling the no-argument getLine method.- Returns:
- the line being annotated, with optional line ending processing based on
client settings (if available). This method is aimed mostly at P4Eclipse and other
specialized usage where file content lines need to be matched or compared
with sync'd file contents (etc.), and may not be particularly useful for general
users: when in doubt, use the simple getLine() method instead.
The returned line will never be null, but may be empty.
- See Also:
IFileAnnotation.getLine(boolean)
-
getAllIntegrations
public java.util.List<IFileAnnotation> getAllIntegrations()
Description copied from interface:IFileAnnotation
Get a list of all contributing integration annotations for this annotation, if such a list exists. In the absence of the use of the GetFileAnnotationsOptions followAllIntegrations option (corresponding to annotate -I), this method will always return null; otherwise, if it is not null, it will contain a list of IFileAnnotation objects representing the contributing integrations. These IFileAnnotation objects will have a non-negative ordering (see getOrdering()), and null line data.- Specified by:
getAllIntegrations
in interfaceIFileAnnotation
- Returns:
- possibly-null list of contributing integrations.
- See Also:
IFileAnnotation.getAllIntegrations()
-
getLower
public int getLower()
- Specified by:
getLower
in interfaceIFileAnnotation
- Returns:
- the lower version or change number for the associated annotation.
- See Also:
IFileAnnotation.getLower()
-
getUpper
public int getUpper()
- Specified by:
getUpper
in interfaceIFileAnnotation
- Returns:
- the upper version or change number for the associated annotation.
- See Also:
IFileAnnotation.getUpper()
-
setUpper
public void setUpper(int upper)
-
setLower
public void setLower(int lower)
-
setDepotPath
public void setDepotPath(java.lang.String depotPath)
-
setLine
public void setLine(java.lang.String line)
-
getLineEnd
public IClientSummary.ClientLineEnd getLineEnd()
-
setLineEnd
public void setLineEnd(IClientSummary.ClientLineEnd lineEnd)
-
getOrdering
public int getOrdering()
- Specified by:
getOrdering
in interfaceIFileAnnotation
- Returns:
- the ordering of this annotation in the associated allIntegrations list, if it exists. If the returned value is -1, this annotation is not part of an integrations list (and is therefore a data annotation).
-
setOrdering
public FileAnnotation setOrdering(int ordering)
-
-