Class ResourceScriptSource

  • java.lang.Object
    • Field Detail

      • logger

        protected final Log logger
        Logger available to subclasses.
    • Constructor Detail

      • ResourceScriptSource

        public ResourceScriptSource(EncodedResource resource)
        Create a new ResourceScriptSource for the given resource.
        resource - the EncodedResource to load the script from
      • ResourceScriptSource

        public ResourceScriptSource(Resource resource)
        Create a new ResourceScriptSource for the given resource.
        resource - the Resource to load the script from (using UTF-8 encoding)
    • Method Detail

      • getResource

        public final Resource getResource()
        Return the Resource to load the script from.
      • setEncoding

        public void setEncoding(@Nullable
                                java.lang.String encoding)
        Set the encoding used for reading the script resource.

        The default value for regular Resources is "UTF-8". A null value implies the platform default.

      • getScriptAsString

        public java.lang.String getScriptAsString()
        Description copied from interface: ScriptSource
        Retrieve the current script source text as String.
        Specified by:
        getScriptAsString in interface ScriptSource
        the script text
        Throws: - if script retrieval failed
      • isModified

        public boolean isModified()
        Description copied from interface: ScriptSource
        Indicate whether the underlying script data has been modified since the last time ScriptSource.getScriptAsString() was called. Returns true if the script has not been read yet.
        Specified by:
        isModified in interface ScriptSource
        whether the script data has been modified
      • retrieveLastModifiedTime

        protected long retrieveLastModifiedTime()
        Retrieve the current last-modified timestamp of the underlying resource.
        the current timestamp, or 0 if not determinable
      • suggestedClassName

        public java.lang.String suggestedClassName()
        Description copied from interface: ScriptSource
        Determine a class name for the underlying script.
        Specified by:
        suggestedClassName in interface ScriptSource
        the suggested class name, or null if none available
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object