Package sonia.scm.repository
Class FileObject
java.lang.Object
sonia.scm.repository.FileObject
- All Implemented Interfaces:
Serializable,LastModifiedAware
The FileObject represents a file or a directory in a repository.
- Since:
- 1.5
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(FileObject child) Adds a child to the list of children .Returns the children of this file if it is a directory.Returns the last commit date for this.Returns the last commit message for this file.Returns the last commit date for this.Returns the length of the file orOptionalLong.empty(), when this value has not been computed (seeisPartialResult()andisComputationAborted()).getName()Returns the name of the file.Returns the parent path of the file.getPath()Returns the path of the file.Return sub repository information or null if the file is not sub repository.booleanIf this istrue, some values for this object have not been computed and will not be computed.booleanReturns true if the file is a directory.booleanIf this istrue, some values for this object have not been computed, yet.booleanvoidsetChildren(List<FileObject> children) Set the children for this file.voidsetCommitDate(Long commitDate) Sets the commit date of the file.voidsetComputationAborted(boolean computationAborted) Set marker, that computation of some values for this object has been aborted.voidsetDescription(String description) Sets the description of the file.voidsetDirectory(boolean directory) Set to true to indicate that the file is a directory.voidSets the length of the file.voidSets the name of the file.voidsetPartialResult(boolean partialResult) Set marker, that some values for this object are not computed, yet.voidSets the path of the file.voidsetSubRepository(SubRepository subRepository) Set sub repository information for the file.voidsetTruncated(boolean truncated)
-
Constructor Details
-
FileObject
public FileObject()
-
-
Method Details
-
getDescription
Returns the last commit message for this file. The method will return null, if the repository provider is not able to get the last commit for the path.- Returns:
- Last commit message or
null, when this value has not been computed (seeisPartialResult()).
-
getLastModified
Returns the last commit date for this. The method will return null, if the repository provider is not able to get the last commit for the path or it has not been computed.- Specified by:
getLastModifiedin interfaceLastModifiedAware- Returns:
- last commit date
-
getCommitDate
Returns the last commit date for this. The method will returnOptionalLong.empty(), if the repository provider is not able to get the last commit for the path or if this value has not been computed (seeisPartialResult()andisComputationAborted()). -
getLength
Returns the length of the file orOptionalLong.empty(), when this value has not been computed (seeisPartialResult()andisComputationAborted()). -
getName
Returns the name of the file. -
getPath
Returns the path of the file. -
getParentPath
Returns the parent path of the file.- Returns:
- parent path
-
getSubRepository
Return sub repository information or null if the file is not sub repository.- Since:
- 1.10
-
isDirectory
public boolean isDirectory()Returns true if the file is a directory. -
getChildren
Returns the children of this file if it is a directory. -
isPartialResult
public boolean isPartialResult()If this istrue, some values for this object have not been computed, yet. These values (likegetLength(),getDescription()orgetCommitDate()) will returnOptional.empty()(orOptionalLong.empty()respectively), unless they are computed. There may be an asynchronous task running, that will set these values in the future.- Returns:
true, whenever some values of this object have not been computed, yet.- Since:
- 2.0.0
-
isComputationAborted
public boolean isComputationAborted()If this istrue, some values for this object have not been computed and will not be computed. These values (likegetLength(),getDescription()orgetCommitDate()) will returnOptional.empty()(orOptionalLong.empty()respectively), unless they are computed.- Returns:
true, whenever some values of this object finally are not computed.- Since:
- 2.0.0
-
isTruncated
public boolean isTruncated() -
setDescription
Sets the description of the file. -
setDirectory
public void setDirectory(boolean directory) Set to true to indicate that the file is a directory. -
setCommitDate
Sets the commit date of the file. -
setLength
Sets the length of the file. -
setName
Sets the name of the file. -
setPath
Sets the path of the file. -
setSubRepository
Set sub repository information for the file.- Since:
- 1.10
-
setPartialResult
public void setPartialResult(boolean partialResult) Set marker, that some values for this object are not computed, yet.- Parameters:
partialResult- Set this totrue, whenever some values of this object are not computed, yet.- Since:
- 2.0.0
-
setComputationAborted
public void setComputationAborted(boolean computationAborted) Set marker, that computation of some values for this object has been aborted.- Parameters:
computationAborted- Set this totrue, whenever some values of this object are not computed and will not be computed in the future.- Since:
- 2.0.0
-
setChildren
Set the children for this file. -
addChild
Adds a child to the list of children .- Parameters:
child- The additional child.
-
setTruncated
public void setTruncated(boolean truncated)
-