public final class HyperlinkLocation extends Object
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
getEndOffset()
The end offset of a hyperlink's target range.
|
FileObject |
getFileObject()
Target file object of this hyperlink.
|
int |
getStartOffset()
The start offset of a hyperlink's target range.
|
int |
hashCode() |
static CompletableFuture<List<HyperlinkLocation>> |
resolve(Document doc,
int offset)
Resolves a hyperlink at the given document offset and returns its target
location(s).
|
static CompletableFuture<List<HyperlinkLocation>> |
resolveTypeDefinition(Document doc,
int offset)
Resolves a hyperlink at the given document offset and returns its target
type definition location(s).
|
String |
toString() |
@NonNull public FileObject getFileObject()
public int getStartOffset()
public int getEndOffset()
@NonNull public static CompletableFuture<List<HyperlinkLocation>> resolve(@NonNull Document doc, int offset)
// Resolve a hyperlink at the given document offset...CompletableFuture
<List
<HyperlinkLocation
>> future =HyperlinkLocation
.resolve(doc, offset); // ...and get its target location(s)List
<HyperlinkLocation
> locations = future.getNow(null); assertNotNull(locations); assertEquals(1, locations.size());HyperlinkLocation
location = locations.get(0); // get location's file objectFileObject
fileObject = location.getFileObject(); assertEquals(srcFile, fileObject); // get location's start offset int startOffset = location.getStartOffset(); assertEquals(10, startOffset); // get location's end offset int endOffset = location.getEndOffset(); assertEquals(20, endOffset);
doc
- document on which to operate.offset
- offset within document@NonNull public static CompletableFuture<List<HyperlinkLocation>> resolveTypeDefinition(@NonNull Document doc, int offset)
// Resolve a hyperlink at the given document offset...CompletableFuture
<List
<HyperlinkLocation
>> future =HyperlinkLocation
.resolveTypeDefinition(doc, offset); // ...and get its target type definition location(s)List
<HyperlinkLocation
> locations = future.getNow(null); assertNotNull(locations); assertEquals(1, locations.size());HyperlinkLocation
location = locations.get(0); // get location's file objectFileObject
fileObject = location.getFileObject(); assertEquals(srcFile, fileObject); // get location's start offset int startOffset = location.getStartOffset(); assertEquals(10, startOffset); // get location's end offset int endOffset = location.getEndOffset(); assertEquals(20, endOffset);
doc
- document on which to operate.offset
- offset within document