GWT 2.7.0

com.google.gwt.core.ext.linker
Class EmittedArtifact

java.lang.Object
  extended by com.google.gwt.core.ext.linker.Artifact<EmittedArtifact>
      extended by 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
static class EmittedArtifact.Visibility
          Describes the visibility of an artifact.
 
Constructor Summary
protected EmittedArtifact(java.lang.Class<? extends Linker> linker, java.lang.String partialPath)
           
 
Method Summary
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.
 boolean isPrivate()
          Deprecated. use getVisibility() instead
 void setPrivate(boolean isPrivate)
          Deprecated. use setVisibility(Visibility) instead
 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>

isPrivate

@Deprecated
public boolean isPrivate()
Deprecated. use getVisibility() instead

Returns whether or not the data contained in the EmittedArtifact should be written into the module output directory or into an auxiliary directory.

EmittedArtifacts that return true for this method will not be emitted into the normal module output location, but will instead be written into a directory that is a sibling to the module output directory. The partial path of the EmittedArtifact will be prepended with the short-name of the Linker type that created the EmittedArtifact.

Private EmittedArtifacts are intended for resources that generally should not be deployed to the server in the same location as the module compilation artifacts.


setPrivate

@Deprecated
public void setPrivate(boolean isPrivate)
Deprecated. use setVisibility(Visibility) instead

Sets the private attribute of the EmittedResource.

Parameters:
isPrivate - true if this artifact is private

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>

GWT 2.7.0