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
ConstructorsConstructorDescriptionDeclarationSourcePositionImpl(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)intreturns the end of the default value int i = 0, j =1 ➡ returns the commaintreturns the last char of the last modifierintreturns the first char of the first modifierHelper for debugging purposes.intGets the index at which the position ends in the source file.voidsetModifierSourceEnd(int modifierSourceEnd)Methods inherited from class spoon.support.reflect.cu.position.CompoundSourcePositionImpl
getDeclarationEnd, getDeclarationStart, getEndColumn, getEndLine, getNameEnd, getNameStart, getSourceStartMethods inherited from class spoon.support.reflect.cu.position.SourcePositionImpl
checkArgsAreAscending, equals, getColumn, getCompilationUnit, getFile, getFragment, getLine, hashCode, isValidPosition, searchColumnNumber, searchLineNumber, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface spoon.reflect.cu.position.CompoundSourcePosition
getDeclarationEnd, getDeclarationStart, getNameEnd, getNameStartMethods 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:DeclarationSourcePositionreturns the end of the default value int i = 0, j =1 ➡ returns the comma- Specified by:
getDefaultValueEndin interfaceDeclarationSourcePosition
-
addDefaultValueEnd
Description copied from interface:DeclarationSourcePositionreturns a new position object enriched a default value declaration (immutability pattern)- Specified by:
addDefaultValueEndin interfaceDeclarationSourcePosition
-
getModifierSourceStart
public int getModifierSourceStart()Description copied from interface:DeclarationSourcePositionreturns the first char of the first modifier- Specified by:
getModifierSourceStartin interfaceDeclarationSourcePosition
-
setModifierSourceEnd
public void setModifierSourceEnd(int modifierSourceEnd) -
getModifierSourceEnd
public int getModifierSourceEnd()Description copied from interface:DeclarationSourcePositionreturns the last char of the last modifier- Specified by:
getModifierSourceEndin interfaceDeclarationSourcePosition
-
getSourceDetails
Description copied from class:SourcePositionImplHelper for debugging purposes. Displays |startIndex; endIndex|sourceCode| of thisSourcePositionIf this instance isDeclarationSourcePositionorBodyHolderSourcePositionThen details about name, modifiers and body are included in resulting string too- Overrides:
getSourceDetailsin classCompoundSourcePositionImpl- Returns:
- details about source code of this
SourcePosition
-
getSourceEnd
public int getSourceEnd()Description copied from interface:SourcePositionGets the index at which the position ends in the source file. Heavily used for the sniper mode.- Specified by:
getSourceEndin interfaceSourcePosition- Overrides:
getSourceEndin classCompoundSourcePositionImpl
-