Class CachingTranspiler

  • All Implemented Interfaces:
    Transpiler

    public final class CachingTranspiler
    extends java.lang.Object
    implements Transpiler
    A transpiler implementation that delegates to a lower-level implementation on a cache miss. Passed a CacheBuilder to allow specifying maximum size and other requirements externally.
    • Field Summary

      • Fields inherited from interface com.google.javascript.jscomp.transpile.Transpiler

        NULL
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String runtime()
      Returns any necessary runtime code as a string.
      TranspileResult transpile​(java.net.URI path, java.lang.String code)
      Transforms the given chunk of code.
      • Methods inherited from class java.lang.Object

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

      • CachingTranspiler

        public CachingTranspiler​(Transpiler delegate,
                                 com.google.common.cache.CacheBuilder<java.lang.Object,​? super TranspileResult> builder)
    • Method Detail

      • transpile

        public TranspileResult transpile​(java.net.URI path,
                                         java.lang.String code)
        Description copied from interface: Transpiler
        Transforms the given chunk of code. The input should be an entire file worth of code.
        Specified by:
        transpile in interface Transpiler
      • runtime

        public java.lang.String runtime()
        Description copied from interface: Transpiler
        Returns any necessary runtime code as a string. This should include everything that could possibly be required at runtime, regardless of whether it's actually used by any of the code that will be transpiled.
        Specified by:
        runtime in interface Transpiler