Class EditableSourceUnit


  • public class EditableSourceUnit
    extends FileSourceUnit
    A source unit that is stored on disk but may also be open in an editor. If the file is being edited, then the file content will come from the editor. Otherwise it will be updated from the file.
    Author:
    Chris Jennings
    • Constructor Summary

      Constructors 
      Constructor Description
      EditableSourceUnit​(java.lang.String identifier, java.io.File loadFrom)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • EditableSourceUnit

        public EditableSourceUnit​(java.lang.String identifier,
                                  java.io.File loadFrom)
    • Method Detail

      • 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 class FileSourceUnit
        Parameters:
        possiblyStaleVersion - the current, possibly out of date, source unit text; may be null