Class DeclarationSourcePositionImpl
java.lang.Object
spoon.support.reflect.cu.position.SourcePositionImpl
spoon.support.reflect.cu.position.CompoundSourcePositionImpl
spoon.support.reflect.cu.position.DeclarationSourcePositionImpl
- All Implemented Interfaces:
Serializable
,Cloneable
,CompoundSourcePosition
,DeclarationSourcePosition
,SourcePosition
- Direct Known Subclasses:
BodyHolderSourcePositionImpl
public class DeclarationSourcePositionImpl
extends CompoundSourcePositionImpl
implements DeclarationSourcePosition, Cloneable
This class represents the position of a Java program element in a source
file.
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from interface spoon.reflect.cu.SourcePosition
NOPOSITION
-
Constructor Summary
ConstructorDescriptionDeclarationSourcePositionImpl(CompilationUnit compilationUnit, int nameStart, int nameEnd, int modifierSourceStart, int modifierSourceEnd, int declarationSourceStart, int declarationSourceEnd, int[] lineSeparatorPositions)
-
Method Summary
Modifier and TypeMethodDescriptionaddDefaultValueEnd(int endDefaultValueDeclaration)
returns a new position object enriched a default value declaration (immutability pattern)int
returns the end of the default value int i = 0, j =1 ➡ returns the commaint
returns the last char of the last modifierint
returns the first char of the first modifierHelper for debugging purposes.int
Gets the index at which the position ends in the source file.void
setModifierSourceEnd(int modifierSourceEnd)
Methods inherited from class spoon.support.reflect.cu.position.CompoundSourcePositionImpl
getDeclarationEnd, getDeclarationStart, getEndColumn, getEndLine, getNameEnd, getNameStart, getSourceStart
Methods inherited from class spoon.support.reflect.cu.position.SourcePositionImpl
checkArgsAreAscending, equals, getColumn, getCompilationUnit, getFile, getFragment, getLine, hashCode, isValidPosition, searchColumnNumber, searchLineNumber, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface spoon.reflect.cu.position.CompoundSourcePosition
getDeclarationEnd, getDeclarationStart, getNameEnd, getNameStart
Methods inherited from interface spoon.reflect.cu.SourcePosition
getColumn, getCompilationUnit, getEndColumn, getEndLine, getFile, getLine, getSourceStart, isValidPosition, toString
-
Constructor Details
-
DeclarationSourcePositionImpl
public DeclarationSourcePositionImpl(CompilationUnit compilationUnit, int nameStart, int nameEnd, int modifierSourceStart, int modifierSourceEnd, int declarationSourceStart, int declarationSourceEnd, int[] lineSeparatorPositions)
-
-
Method Details
-
getDefaultValueEnd
public int getDefaultValueEnd()Description copied from interface:DeclarationSourcePosition
returns the end of the default value int i = 0, j =1 ➡ returns the comma- Specified by:
getDefaultValueEnd
in interfaceDeclarationSourcePosition
-
addDefaultValueEnd
Description copied from interface:DeclarationSourcePosition
returns a new position object enriched a default value declaration (immutability pattern)- Specified by:
addDefaultValueEnd
in interfaceDeclarationSourcePosition
-
getModifierSourceStart
public int getModifierSourceStart()Description copied from interface:DeclarationSourcePosition
returns the first char of the first modifier- Specified by:
getModifierSourceStart
in interfaceDeclarationSourcePosition
-
setModifierSourceEnd
public void setModifierSourceEnd(int modifierSourceEnd) -
getModifierSourceEnd
public int getModifierSourceEnd()Description copied from interface:DeclarationSourcePosition
returns the last char of the last modifier- Specified by:
getModifierSourceEnd
in interfaceDeclarationSourcePosition
-
getSourceDetails
Description copied from class:SourcePositionImpl
Helper for debugging purposes. Displays |startIndex; endIndex|sourceCode| of thisSourcePosition
If this instance isDeclarationSourcePosition
orBodyHolderSourcePosition
Then details about name, modifiers and body are included in resulting string too- Overrides:
getSourceDetails
in classCompoundSourcePositionImpl
- Returns:
- details about source code of this
SourcePosition
-
getSourceEnd
public int getSourceEnd()Description copied from interface:SourcePosition
Gets the index at which the position ends in the source file. Heavily used for the sniper mode.- Specified by:
getSourceEnd
in interfaceSourcePosition
- Overrides:
getSourceEnd
in classCompoundSourcePositionImpl
-