org.plovr
Class ResourceJsInput

java.lang.Object
  extended by org.plovr.AbstractJsInput
      extended by org.plovr.ResourceJsInput
All Implemented Interfaces:
com.google.javascript.jscomp.SourceFile.Generator, JsInput

public class ResourceJsInput
extends AbstractJsInput

ResourceJsInput represents a JavaScript file loaded from a JAR, so it will never change, so its dependencies must only be read once.

Author:
bolinfest@gmail.com (Michael Bolin)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.plovr.JsInput
JsInput.CodeWithEtag
 
Field Summary
 
Fields inherited from class org.plovr.AbstractJsInput
provides, requires
 
Method Summary
 java.lang.String getCode()
           
 JsInput.CodeWithEtag getCodeWithEtag()
          If JsInput.supportsEtags() returns true, then this returns the value returned by JsInput.getCode() along with an ETag; otherwise, it throws an UnsupportedOperationException.
 boolean supportsEtags()
          Whether this input can calculate a stable ETag value for itself.
 
Methods inherited from class org.plovr.AbstractJsInput
calculateEtagFor, getName, getProvides, getRequires, getTemplateCode, hasInputChanged, isSoyFile, processProvidesAndRequires, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getCodeWithEtag

public JsInput.CodeWithEtag getCodeWithEtag()
Description copied from interface: JsInput
If JsInput.supportsEtags() returns true, then this returns the value returned by JsInput.getCode() along with an ETag; otherwise, it throws an UnsupportedOperationException.

This is generally used as a performance optimization to prevent plovr from going to disk twice: once to read the code for JsInput.getCode() and then again to read the code and calculate its ETag. This ensures that the code and ETag are produced atomically.

Specified by:
getCodeWithEtag in interface JsInput
Overrides:
getCodeWithEtag in class AbstractJsInput

getCode

public java.lang.String getCode()
Specified by:
getCode in interface com.google.javascript.jscomp.SourceFile.Generator
Specified by:
getCode in interface JsInput
Specified by:
getCode in class AbstractJsInput
Returns:
JavaScript code

supportsEtags

public boolean supportsEtags()
Description copied from interface: JsInput
Whether this input can calculate a stable ETag value for itself.

Specified by:
supportsEtags in interface JsInput
Overrides:
supportsEtags in class AbstractJsInput
See Also:
JsInput.getCodeWithEtag()