Top Description Fields Constructors Methods
org.aspectj.bridge

public Class SourceLocation

extends Object
implements ISourceLocation
Class Inheritance
All Implemented Interfaces
org.aspectj.bridge.ISourceLocation, java.io.Serializable
Imports
java.io.File, org.aspectj.util.LangUtil

Immutable source location. This guarantees that the source file is not null and that the numeric values are positive and line ≤ endLine.
See Also
org.aspectj.lang.reflect.SourceLocation

Field Summary

Modifier and TypeField and Description
private transient int
private final int
private final String
private final int
private boolean
private int
private static final long
private final File
private String
private final int
public static final ISourceLocation
UNKNOWN

used when SourceLocation is not available

Constructor Summary

AccessConstructor and Description
public
SourceLocation(File file, int line)

Same as SourceLocation(file, line, line, 0), except that column is not rendered during toString()

public
SourceLocation(File file, int line, int endLine)

same as SourceLocation(file, line, endLine, ISourceLocation.NO_COLUMN)

public
SourceLocation(File
File of the source; if null, use ISourceLocation.NO_FILE, not null
file
,
int
int starting line of the location - positive number
line
,
int
int ending line of the location - ≤ starting line
endLine
,
int
int character position of starting location - positive number
column
)

public
SourceLocation(File file, int line, int endLine, int column, String context)

public
SourceLocation(File file, int line, int endLine, int column, String context, String sourceFileName)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int

Returns:

int actual column or 0 if not available per constructor treatment of ISourceLocation.NO_COLUMN
getColumn
()

Implements org.aspectj.bridge.ISourceLocation.getColumn.

public String

Returns:

null String or application-specific context
getContext
()

Implements org.aspectj.bridge.ISourceLocation.getContext.

public int
public int
public int
public File
public String
getSourceFileName()

Implements org.aspectj.bridge.ISourceLocation.getSourceFileName.

In the cases where getSourceFile().getName() returns a class file (for example when we have a binary aspect) this should return the name of the source file (for example BinaryAspect.aj)
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public void
setOffset(int i)

public String

Returns:

String {context\n}{file:}line{:column}
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public static final void
validColumn(int column)

public static final void
validLine(int line)

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

cachedHashcodeback to summary
private transient int cachedHashcode
columnback to summary
private final int column
contextback to summary
private final String context
endLineback to summary
private final int endLine
noColumnback to summary
private boolean noColumn
offsetback to summary
private int offset
serialVersionUIDback to summary
private static final long serialVersionUID
sourceFileback to summary
private final File sourceFile
sourceFileNameback to summary
private String sourceFileName
startLineback to summary
private final int startLine
UNKNOWNback to summary
public static final ISourceLocation UNKNOWN

used when SourceLocation is not available

Constructor Detail

SourceLocationback to summary
public SourceLocation(File file, int line)

Same as SourceLocation(file, line, line, 0), except that column is not rendered during toString()

SourceLocationback to summary
public SourceLocation(File file, int line, int endLine)

same as SourceLocation(file, line, endLine, ISourceLocation.NO_COLUMN)

SourceLocationback to summary
public SourceLocation(File file, int line, int endLine, int column)
Parameters
file:File

File of the source; if null, use ISourceLocation.NO_FILE, not null

line:int

int starting line of the location - positive number

endLine:int

int ending line of the location - ≤ starting line

column:int

int character position of starting location - positive number

SourceLocationback to summary
public SourceLocation(File file, int line, int endLine, int column, String context)
SourceLocationback to summary
public SourceLocation(File file, int line, int endLine, int column, String context, String sourceFileName)

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

getColumnback to summary
public int getColumn()

Implements org.aspectj.bridge.ISourceLocation.getColumn.

Returns:int

int actual column or 0 if not available per constructor treatment of ISourceLocation.NO_COLUMN

getContextback to summary
public String getContext()

Implements org.aspectj.bridge.ISourceLocation.getContext.

Returns:String

null String or application-specific context

getEndLineback to summary
public int getEndLine()

Implements org.aspectj.bridge.ISourceLocation.getEndLine.

Returns:int

Doc from org.aspectj.bridge.ISourceLocation.getEndLine.

getLine()..MAX_LINE

getLineback to summary
public int getLine()

Implements org.aspectj.bridge.ISourceLocation.getLine.

Returns:int

Doc from org.aspectj.bridge.ISourceLocation.getLine.

0..MAX_LINE

getOffsetback to summary
public int getOffset()

Implements org.aspectj.bridge.ISourceLocation.getOffset.

Returns:int

Doc from org.aspectj.bridge.ISourceLocation.getOffset.

offset into file

getSourceFileback to summary
public File getSourceFile()

Implements org.aspectj.bridge.ISourceLocation.getSourceFile.

Returns:File

Doc from org.aspectj.bridge.ISourceLocation.getSourceFile.

File source or NO_FILE if the implementation requires a non-null result or null otherwise

getSourceFileNameback to summary
public String getSourceFileName()

Implements org.aspectj.bridge.ISourceLocation.getSourceFileName.

Doc from org.aspectj.bridge.ISourceLocation.getSourceFileName.

In the cases where getSourceFile().getName() returns a class file (for example when we have a binary aspect) this should return the name of the source file (for example BinaryAspect.aj)

Returns:String

the name of the source file

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

setOffsetback to summary
public void setOffset(int i)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

String {context\n}{file:}line{:column}

validColumnback to summary
public static final void validColumn(int column)
Exceptions
IllegalArgumentException:
if the input would not be a valid column
validLineback to summary
public static final void validLine(int line)
Exceptions
IllegalArgumentException:
if the input would not be a valid line