Package org.sonar.api.batch.fs.internal
Class DefaultInputFile
java.lang.Object
org.sonar.api.batch.fs.internal.DefaultInputComponent
org.sonar.api.batch.fs.internal.DefaultInputFile
- All Implemented Interfaces:
org.sonar.api.batch.fs.IndexedFile
,org.sonar.api.batch.fs.InputComponent
,org.sonar.api.batch.fs.InputFile
,org.sonar.api.batch.fs.InputPath
public class DefaultInputFile
extends DefaultInputComponent
implements org.sonar.api.batch.fs.InputFile
- Since:
- 4.2
To create
InputFile
in tests, use TestInputFileBuilder.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.sonar.api.batch.fs.InputFile
org.sonar.api.batch.fs.InputFile.Status, org.sonar.api.batch.fs.InputFile.Type
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultInputFile
(DefaultIndexedFile indexedFile, Consumer<DefaultInputFile> metadataGenerator, String contents, Consumer<DefaultInputFile> scmStatusGenerator) DefaultInputFile
(DefaultIndexedFile indexedFile, Consumer<DefaultInputFile> metadataGenerator, Consumer<DefaultInputFile> scmStatusGenerator) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addIgnoreIssuesOnLineRanges
(Collection<int[]> lineRanges) charset()
void
contents()
boolean
file()
filename()
int
hashCode()
boolean
hasNoSonarAt
(int line) boolean
isEmpty()
boolean
boolean
boolean
isFile()
boolean
boolean
boolean
boolean
boolean
key()
Component key (without branch).language()
int
int
lineLength
(int line) int
lines()
md5Hash()
Digest hash of the file.org.sonar.api.batch.fs.TextPointer
newPointer
(int globalOffset) org.sonar.api.batch.fs.TextPointer
newPointer
(int line, int lineOffset) org.sonar.api.batch.fs.TextRange
newRange
(int startOffset, int endOffset) Create Range from global offsets.org.sonar.api.batch.fs.TextRange
newRange
(int startLine, int startLineOffset, int endLine, int endLineOffset) org.sonar.api.batch.fs.TextRange
newRange
(org.sonar.api.batch.fs.TextPointer start, org.sonar.api.batch.fs.TextPointer end) int
void
int[]
int[]
path()
Deprecated.since 6.6org.sonar.api.batch.fs.TextRange
selectLine
(int line) setCharset
(Charset charset) setExcludedForCoverage
(boolean excludedForCoverage) setExcludedForDuplication
(boolean excludedForDuplication) void
setExecutableLines
(Set<Integer> executableLines) void
setIgnoreAllIssues
(boolean ignoreAllIssues) setMarkedAsUnchanged
(boolean markedAsUnchanged) setMetadata
(Metadata metadata) setPublished
(boolean published) setStatus
(org.sonar.api.batch.fs.InputFile.Status status) org.sonar.api.batch.fs.InputFile.Status
status()
toString()
org.sonar.api.batch.fs.InputFile.Type
type()
uri()
void
validate
(org.sonar.api.batch.fs.TextRange range) Methods inherited from class org.sonar.api.batch.fs.internal.DefaultInputComponent
hasMeasureFor, scannerId, setHasMeasureFor
-
Constructor Details
-
DefaultInputFile
public DefaultInputFile(DefaultIndexedFile indexedFile, Consumer<DefaultInputFile> metadataGenerator, Consumer<DefaultInputFile> scmStatusGenerator) -
DefaultInputFile
public DefaultInputFile(DefaultIndexedFile indexedFile, Consumer<DefaultInputFile> metadataGenerator, @Nullable String contents, Consumer<DefaultInputFile> scmStatusGenerator)
-
-
Method Details
-
checkMetadata
public void checkMetadata() -
inputStream
- Specified by:
inputStream
in interfaceorg.sonar.api.batch.fs.IndexedFile
- Specified by:
inputStream
in interfaceorg.sonar.api.batch.fs.InputFile
- Throws:
IOException
-
isMarkedAsUnchanged
public boolean isMarkedAsUnchanged() -
setMarkedAsUnchanged
-
contents
- Specified by:
contents
in interfaceorg.sonar.api.batch.fs.InputFile
- Throws:
IOException
-
setPublished
-
isPublished
public boolean isPublished() -
setExcludedForCoverage
-
isExcludedForCoverage
public boolean isExcludedForCoverage() -
setExcludedForDuplication
-
isExcludedForDuplication
public boolean isExcludedForDuplication() -
relativePath
Deprecated.since 6.6- Specified by:
relativePath
in interfaceorg.sonar.api.batch.fs.IndexedFile
- Specified by:
relativePath
in interfaceorg.sonar.api.batch.fs.InputFile
- Specified by:
relativePath
in interfaceorg.sonar.api.batch.fs.InputPath
-
getModuleRelativePath
-
getProjectRelativePath
-
absolutePath
- Specified by:
absolutePath
in interfaceorg.sonar.api.batch.fs.IndexedFile
- Specified by:
absolutePath
in interfaceorg.sonar.api.batch.fs.InputFile
- Specified by:
absolutePath
in interfaceorg.sonar.api.batch.fs.InputPath
-
oldRelativePath
-
file
- Specified by:
file
in interfaceorg.sonar.api.batch.fs.IndexedFile
- Specified by:
file
in interfaceorg.sonar.api.batch.fs.InputFile
- Specified by:
file
in interfaceorg.sonar.api.batch.fs.InputPath
-
path
- Specified by:
path
in interfaceorg.sonar.api.batch.fs.IndexedFile
- Specified by:
path
in interfaceorg.sonar.api.batch.fs.InputFile
- Specified by:
path
in interfaceorg.sonar.api.batch.fs.InputPath
-
language
- Specified by:
language
in interfaceorg.sonar.api.batch.fs.IndexedFile
- Specified by:
language
in interfaceorg.sonar.api.batch.fs.InputFile
-
type
public org.sonar.api.batch.fs.InputFile.Type type()- Specified by:
type
in interfaceorg.sonar.api.batch.fs.IndexedFile
- Specified by:
type
in interfaceorg.sonar.api.batch.fs.InputFile
-
key
Component key (without branch).- Specified by:
key
in interfaceorg.sonar.api.batch.fs.InputComponent
-
hashCode
public int hashCode()- Overrides:
hashCode
in classDefaultInputComponent
-
toString
- Specified by:
toString
in interfaceorg.sonar.api.batch.fs.InputFile
- Overrides:
toString
in classDefaultInputComponent
-
status
public org.sonar.api.batch.fs.InputFile.Status status()- Specified by:
status
in interfaceorg.sonar.api.batch.fs.InputFile
-
isStatusSet
public boolean isStatusSet() -
lines
public int lines()- Specified by:
lines
in interfaceorg.sonar.api.batch.fs.InputFile
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceorg.sonar.api.batch.fs.InputFile
-
charset
- Specified by:
charset
in interfaceorg.sonar.api.batch.fs.InputFile
-
lastValidOffset
public int lastValidOffset() -
md5Hash
Digest hash of the file.- Specified by:
md5Hash
in interfaceorg.sonar.api.batch.fs.InputFile
-
nonBlankLines
public int nonBlankLines() -
originalLineStartOffsets
public int[] originalLineStartOffsets() -
originalLineEndOffsets
public int[] originalLineEndOffsets() -
newPointer
public org.sonar.api.batch.fs.TextPointer newPointer(int line, int lineOffset) - Specified by:
newPointer
in interfaceorg.sonar.api.batch.fs.InputFile
-
newRange
public org.sonar.api.batch.fs.TextRange newRange(org.sonar.api.batch.fs.TextPointer start, org.sonar.api.batch.fs.TextPointer end) - Specified by:
newRange
in interfaceorg.sonar.api.batch.fs.InputFile
-
newRange
public org.sonar.api.batch.fs.TextRange newRange(int startLine, int startLineOffset, int endLine, int endLineOffset) - Specified by:
newRange
in interfaceorg.sonar.api.batch.fs.InputFile
-
selectLine
public org.sonar.api.batch.fs.TextRange selectLine(int line) - Specified by:
selectLine
in interfaceorg.sonar.api.batch.fs.InputFile
-
validate
public void validate(org.sonar.api.batch.fs.TextRange range) -
newRange
public org.sonar.api.batch.fs.TextRange newRange(int startOffset, int endOffset) Create Range from global offsets. Used for backward compatibility with older API. -
newPointer
public org.sonar.api.batch.fs.TextPointer newPointer(int globalOffset) -
setStatus
-
setCharset
-
lineLength
public int lineLength(int line) -
setMetadata
-
equals
- Overrides:
equals
in classDefaultInputComponent
-
isFile
public boolean isFile()- Specified by:
isFile
in interfaceorg.sonar.api.batch.fs.InputComponent
-
filename
- Specified by:
filename
in interfaceorg.sonar.api.batch.fs.IndexedFile
-
uri
- Specified by:
uri
in interfaceorg.sonar.api.batch.fs.IndexedFile
- Specified by:
uri
in interfaceorg.sonar.api.batch.fs.InputPath
-
noSonarAt
-
hasNoSonarAt
public boolean hasNoSonarAt(int line) -
isIgnoreAllIssues
public boolean isIgnoreAllIssues() -
setIgnoreAllIssues
public void setIgnoreAllIssues(boolean ignoreAllIssues) -
addIgnoreIssuesOnLineRanges
-
isIgnoreAllIssuesOnLine
-
setExecutableLines
-
getExecutableLines
-