org.plovr
Interface JsInput

All Superinterfaces:
com.google.javascript.jscomp.SourceFile.Generator
All Known Implementing Classes:
AbstractJsInput, CoffeeFile, JsSourceFile, LocalFileJsInput, ResourceJsInput, SoyFile

public interface JsInput
extends com.google.javascript.jscomp.SourceFile.Generator

JsInput represents a JavaScript input to the Closure Compiler.

Author:
bolinfest@gmail.com (Michael Bolin)

Nested Class Summary
static class JsInput.CodeWithEtag
           
 
Method Summary
 java.lang.String getCode()
           
 JsInput.CodeWithEtag getCodeWithEtag()
          If supportsEtags() returns true, then this returns the value returned by getCode() along with an ETag; otherwise, it throws an UnsupportedOperationException.
 java.lang.String getName()
           
 java.util.List<java.lang.String> getProvides()
           
 java.util.List<java.lang.String> getRequires()
           
 java.lang.String getTemplateCode()
           
 boolean isSoyFile()
           
 boolean supportsEtags()
          Whether this input can calculate a stable ETag value for itself.
 

Method Detail

getName

java.lang.String getName()
Returns:
name of a JsInput must be unique among the other inputs included in a compilation so that warnings and errors can be reported appropriately.

getCode

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

getProvides

java.util.List<java.lang.String> getProvides()
Returns:
a list of the values passed to goog.provide() in this input

getRequires

java.util.List<java.lang.String> getRequires()
Returns:
a list of the values passed to goog.require() in this input

isSoyFile

boolean isSoyFile()
Returns:
a boolean indicating whether this is a Soy file. If true, then getTemplateCode() must return the original Soy content.

getTemplateCode

java.lang.String getTemplateCode()
Returns:
the underlying template code if this is a Soy file
Throws:
java.lang.UnsupportedOperationException - if this is not a Soy file

supportsEtags

boolean supportsEtags()
Whether this input can calculate a stable ETag value for itself.

See Also:
getCodeWithEtag()

getCodeWithEtag

JsInput.CodeWithEtag getCodeWithEtag()
If supportsEtags() returns true, then this returns the value returned by 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 getCode() and then again to read the code and calculate its ETag. This ensures that the code and ETag are produced atomically.