com.google.gwt.core.ext.linker

## Class EmittedArtifact

- java.lang.Object
- - com.google.gwt.core.ext.linker.Artifact<EmittedArtifact>
  - - com.google.gwt.core.ext.linker.EmittedArtifact

All Implemented Interfaces:
  java.io.Serializable, java.lang.Comparable<Artifact<?>>

Direct Known Subclasses:
  BinaryEmittedArtifact, GeneratedResource, PublicResource, SyntheticArtifact

    public abstract class EmittedArtifact
    extends Artifact<EmittedArtifact>

An artifact that will be emitted into the output. All EmittedArtifacts contained in the `ArtifactSet` at the end of the Linking process will be emitted by the compiler into the module's output directory. This type may be extended by Linker providers to provide alternative implementations of `getContents(TreeLogger)`. TODO(bobv): provide a timestamp so we can make the time on output files match that of input files?

See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static class` `EmittedArtifact.Visibility` Describes the visibility of an artifact.

### Constructor Summary

Constructors
`protected` `EmittedArtifact(java.lang.Class<? extends Linker> linker, java.lang.String partialPath)`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected int` `compareToComparableArtifact(EmittedArtifact o)` Performs comparison with an artifact of a compatible base type.
`protected java.lang.Class<EmittedArtifact>` `getComparableArtifactType()` Returns the base type to use for comparisons between Artifacts.
`abstract java.io.InputStream` `getContents(TreeLogger logger)` Provides access to the contents of the EmittedResource.
`long` `getLastModified()` Returns the time, measured in milliseconds from the epoch, at which the Artifact was last modified.
`java.lang.String` `getPartialPath()` Returns the partial path within the output directory of the EmittedArtifact.
`EmittedArtifact.Visibility` `getVisibility()`
`int` `hashCode()` The class which is returned from `Artifact.getComparableArtifactType()` must declare a final implementation which returns the same hash code for objects for which `Artifact.compareToComparableArtifact(Artifact)` returns 0.
`void` `setVisibility(EmittedArtifact.Visibility visibility)`
`java.lang.String` `toString()`
`void` `writeTo(TreeLogger logger, java.io.OutputStream out)` Provides access to the contents of the EmittedResource.

### Methods inherited from class com.google.gwt.core.ext.linker.Artifact

`compareTo, equals, getLinker, isTransferableFromShards`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### EmittedArtifact

    protected EmittedArtifact(java.lang.Class<? extends Linker> linker,
                              java.lang.String partialPath)

### Method Detail

#### getContents

    public abstract java.io.InputStream getContents(TreeLogger logger)
                                             throws UnableToCompleteException

Provides access to the contents of the EmittedResource.

Throws:
  `UnableToCompleteException`

#### getLastModified

    public long getLastModified()

Returns the time, measured in milliseconds from the epoch, at which the Artifact was last modified. This will be used to set the last-modified timestamp on the files written to disk.

The default implementation always returns the current time. Subclasses should override this method to provide a type-appropriate value.

Returns:
  the time at which the Artifact was last modified

#### getPartialPath

    public final java.lang.String getPartialPath()

Returns the partial path within the output directory of the EmittedArtifact.

#### getVisibility

    public EmittedArtifact.Visibility getVisibility()

Returns:
  the visibility

#### hashCode

    public final int hashCode()

Description copied from class: `Artifact`
The class which is returned from `Artifact.getComparableArtifactType()` must declare a final implementation which returns the same hash code for objects for which `Artifact.compareToComparableArtifact(Artifact)` returns 0.

Specified by:
  `hashCode` in class `Artifact<EmittedArtifact>`

#### setVisibility

    public void setVisibility(EmittedArtifact.Visibility visibility)

Parameters:
  `visibility` - the visibility to set

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `Artifact<EmittedArtifact>`

#### writeTo

    public void writeTo(TreeLogger logger,
                        java.io.OutputStream out)
                 throws UnableToCompleteException

Provides access to the contents of the EmittedResource.

Throws:
  `UnableToCompleteException`

#### compareToComparableArtifact

    protected final int compareToComparableArtifact(EmittedArtifact o)

Description copied from class: `Artifact`
Performs comparison with an artifact of a compatible base type. Objects which compare to 0 are assumed equal, and must return the same `Artifact.hashCode()`.

Specified by:
  `compareToComparableArtifact` in class `Artifact<EmittedArtifact>`

#### getComparableArtifactType

    protected final java.lang.Class<EmittedArtifact> getComparableArtifactType()

Description copied from class: `Artifact`
Returns the base type to use for comparisons between Artifacts. All concrete implementations of this methods must be final.

Specified by:
  `getComparableArtifactType` in class `Artifact<EmittedArtifact>`