Class Source


  • @GwtIncompatible
    @Immutable
    public abstract class Source
    extends java.lang.Object
    An abstract representation of a source file.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Source.Builder
      Builder for Source instances.
      static interface  Source.Transformer
      An automorphic transformation on sources.
    • Constructor Summary

      Constructors 
      Constructor Description
      Source()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static Source.Builder builder()
      Makes a new empty builder.
      java.lang.String code()
      The actual code in this source file.
      abstract int estimatedSize()
      A best estimate of the size of this source (in case the source itself is not yet loaded.
      abstract com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.String> loadFlags()
      The load flags, specifying module type and language level.
      java.lang.String originalCode()
      The untransformed code from the original source file.
      abstract java.nio.file.Path path()
      The path of this source.
      abstract com.google.common.collect.ImmutableSet<java.lang.String> runtimes()
      Any runtime libraries necessary for this source.
      abstract java.lang.String sourceMap()
      The text of any source map applicable to this file.
      abstract java.lang.String sourceMappingUrl()
      The URL for a source map associated with this file.
      abstract java.lang.String sourceUrl()
      The source URL associated with this file.
      abstract Source.Builder toBuilder()
      Copies the data from this source to a new builder.
      • Methods inherited from class java.lang.Object

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

      • Source

        public Source()
    • Method Detail

      • path

        public abstract java.nio.file.Path path()
        The path of this source. This may refer to a path on disk or a path on the HTTP server.
      • sourceMap

        public abstract java.lang.String sourceMap()
        The text of any source map applicable to this file.
      • sourceUrl

        public abstract java.lang.String sourceUrl()
        The source URL associated with this file.
      • sourceMappingUrl

        public abstract java.lang.String sourceMappingUrl()
        The URL for a source map associated with this file.
      • runtimes

        public abstract com.google.common.collect.ImmutableSet<java.lang.String> runtimes()
        Any runtime libraries necessary for this source. Any transformation that adds a runtime library to any sources must be responsible to never add the same library as a substring to a different source (so that the "no duplicates" invariant of Set will work correctly).
      • loadFlags

        public abstract com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.String> loadFlags()
        The load flags, specifying module type and language level.
      • estimatedSize

        public abstract int estimatedSize()
        A best estimate of the size of this source (in case the source itself is not yet loaded.
      • code

        public final java.lang.String code()
        The actual code in this source file.
      • originalCode

        public final java.lang.String originalCode()
        The untransformed code from the original source file.
      • toBuilder

        public abstract Source.Builder toBuilder()
        Copies the data from this source to a new builder.
      • builder

        public static Source.Builder builder()
        Makes a new empty builder.