Class FileSourceUnit
- java.lang.Object
-
- ca.cgjennings.apps.arkham.plugins.typescript.SourceUnit
-
- ca.cgjennings.apps.arkham.plugins.typescript.FileSourceUnit
-
- Direct Known Subclasses:
EditableSourceUnit
public class FileSourceUnit extends SourceUnit
A source unit whose content is linked to a file. The source unit path does not need to match the actual file.- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Constructor Description FileSourceUnit(java.lang.String identifier, java.io.File loadFrom)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.File
getFile()
Returns the file that this source unit is updated from.protected void
updateFromSource(java.lang.String possiblyStaleVersion)
This method is called whenever the source's version or text is requested, before a result is returned.-
Methods inherited from class ca.cgjennings.apps.arkham.plugins.typescript.SourceUnit
getPath, getText, getVersion, toString, update
-
-
-
-
Method Detail
-
getFile
public final java.io.File getFile()
Returns the file that this source unit is updated from.- Returns:
- the non-null file that backs this source unit
-
updateFromSource
protected void updateFromSource(java.lang.String possiblyStaleVersion)
Description copied from class:SourceUnit
This method is called whenever the source's version or text is requested, before a result is returned. If the source unit subclass knows that a more up-to-date result is available than the one currently stored in the source unit, it can immediately update the source unit to the latest version.This can be used to implement features such as lazily-loaded static files or source units tied to files in the file system that update when the file changes. The base class does meaning, which means that the text of the source unit can only change if explicitly updated.
Subclasses which override this method should ensure that it returns as quickly as possible if the source has not changed.
- Overrides:
updateFromSource
in classSourceUnit
- Parameters:
possiblyStaleVersion
- the current, possibly out of date, source unit text; may be null
-
-