hudson.plugins.checkstyle.util
Class BuildResult

java.lang.Object
  extended by hudson.plugins.checkstyle.util.BuildResult
All Implemented Interfaces:
hudson.model.ModelObject, AnnotationProvider, java.io.Serializable
Direct Known Subclasses:
AnnotationsBuildResult

public abstract class BuildResult
extends java.lang.Object
implements hudson.model.ModelObject, java.io.Serializable, AnnotationProvider

A base class for build results that is capable of storing a reference to the current build. Provides support for persisting the results of the build.

Author:
Ulli Hafner
See Also:
Serialized Form

Field Summary
protected static com.thoughtworks.xstream.XStream XSTREAM
          Serialization provider.
 
Constructor Summary
BuildResult(hudson.model.AbstractBuild<?,?> build, java.util.Set<java.lang.String> modules, java.util.Collection<java.lang.String> errorMessages, java.lang.String defaultEncoding)
          Creates a new instance of BuildResult.
 
Method Summary
 FileAnnotation getAnnotation(long key)
          Returns the annotation with the specified key.
 FileAnnotation getAnnotation(java.lang.String key)
          Returns the annotation with the specified key.
 java.util.Collection<FileAnnotation> getAnnotations()
          Returns the annotations for this object.
 java.util.Collection<FileAnnotation> getAnnotations(Priority priority)
          Returns the annotations of the specified priority for this object.
 java.util.Collection<FileAnnotation> getAnnotations(java.lang.String priority)
          Returns the annotations of the specified priority for this object.
abstract  AnnotationContainer getContainer()
          Gets the annotation container.
protected  hudson.XmlFile getDataFile()
          Returns the serialization file.
 java.lang.String getDefaultEncoding()
          Returns the defined default encoding.
 java.util.List<java.lang.String> getErrors()
          Returns the error messages associated with this build.
 java.util.Collection<java.lang.String> getModules()
          Returns the modules of this build result.
 int getNumberOfAnnotations(java.lang.String priority)
          Returns the annotations of the specified priority for this object.
 int getNumberOfModules()
          Returns the number of modules in this project.
 hudson.model.AbstractBuild<?,?> getOwner()
          Returns the build as owner of this action.
protected abstract  java.lang.String getSerializationFileName()
          Returns the name of the file to store the serialized annotations.
 boolean hasAnnotations()
          Returns whether this objects has annotations.
 boolean hasAnnotations(Priority priority)
          Returns whether this objects has annotations with the specified priority.
 boolean hasAnnotations(java.lang.String priority)
          Returns whether this objects has annotations with the specified priority.
 boolean hasError()
          Returns whether a module with an error is part of this project.
 boolean hasNoAnnotations()
          Returns whether this objects has no annotations.
 boolean hasNoAnnotations(Priority priority)
          Returns whether this objects has no annotations with the specified priority.
 boolean hasNoAnnotations(java.lang.String priority)
          Returns whether this objects has no annotations with the specified priority.
 boolean isCurrent()
          Returns whether this result belongs to the last build.
protected  java.lang.Object readResolve()
          Initializes members that were not present in previous versions of this plug-in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.model.ModelObject
getDisplayName
 
Methods inherited from interface hudson.plugins.checkstyle.util.model.AnnotationProvider
getNumberOfAnnotations, getNumberOfAnnotations
 

Field Detail

XSTREAM

protected static final com.thoughtworks.xstream.XStream XSTREAM
Serialization provider.

Constructor Detail

BuildResult

public BuildResult(hudson.model.AbstractBuild<?,?> build,
                   java.util.Set<java.lang.String> modules,
                   java.util.Collection<java.lang.String> errorMessages,
                   java.lang.String defaultEncoding)
Creates a new instance of BuildResult.

Parameters:
build - owner of this result
modules - the modules represented by this result
errorMessages - the error messages during the build
defaultEncoding - the default encoding to be used when reading and parsing files
Method Detail

hasError

public boolean hasError()
Returns whether a module with an error is part of this project.

Returns:
true if at least one module has an error.

getErrors

public java.util.List<java.lang.String> getErrors()
Returns the error messages associated with this build.

Returns:
the error messages

readResolve

protected java.lang.Object readResolve()
Initializes members that were not present in previous versions of this plug-in.

Returns:
the created object

getModules

public java.util.Collection<java.lang.String> getModules()
Returns the modules of this build result.

Returns:
the modules

getNumberOfModules

public int getNumberOfModules()
Returns the number of modules in this project.

Returns:
the number of modules

getDefaultEncoding

public java.lang.String getDefaultEncoding()
Returns the defined default encoding.

Returns:
the default encoding

getDataFile

protected final hudson.XmlFile getDataFile()
Returns the serialization file.

Returns:
the serialization file.

getSerializationFileName

protected abstract java.lang.String getSerializationFileName()
Returns the name of the file to store the serialized annotations.

Returns:
the name of the file to store the serialized annotations

isCurrent

public final boolean isCurrent()
Returns whether this result belongs to the last build.

Returns:
true if this result belongs to the last build

getOwner

public final hudson.model.AbstractBuild<?,?> getOwner()
Returns the build as owner of this action.

Returns:
the owner

hasAnnotations

public boolean hasAnnotations(Priority priority)
Returns whether this objects has annotations with the specified priority.

Specified by:
hasAnnotations in interface AnnotationProvider
Parameters:
priority - the priority
Returns:
true if this objects has annotations.

hasAnnotations

public boolean hasAnnotations(java.lang.String priority)
Returns whether this objects has annotations with the specified priority.

Specified by:
hasAnnotations in interface AnnotationProvider
Parameters:
priority - the priority as a string object
Returns:
true if this objects has annotations.

hasAnnotations

public final boolean hasAnnotations()
Returns whether this objects has annotations.

Specified by:
hasAnnotations in interface AnnotationProvider
Returns:
true if this objects has annotations.

hasNoAnnotations

public boolean hasNoAnnotations()
Returns whether this objects has no annotations.

Specified by:
hasNoAnnotations in interface AnnotationProvider
Returns:
true if this objects has no annotations.

hasNoAnnotations

public boolean hasNoAnnotations(Priority priority)
Returns whether this objects has no annotations with the specified priority.

Specified by:
hasNoAnnotations in interface AnnotationProvider
Parameters:
priority - the priority
Returns:
true if this objects has no annotations.

hasNoAnnotations

public boolean hasNoAnnotations(java.lang.String priority)
Returns whether this objects has no annotations with the specified priority.

Specified by:
hasNoAnnotations in interface AnnotationProvider
Parameters:
priority - the priority as a string object
Returns:
true if this objects has no annotations.

getAnnotations

public java.util.Collection<FileAnnotation> getAnnotations()
Returns the annotations for this object.

Specified by:
getAnnotations in interface AnnotationProvider
Returns:
annotations for this object

getAnnotation

public FileAnnotation getAnnotation(long key)
Returns the annotation with the specified key.

Specified by:
getAnnotation in interface AnnotationProvider
Parameters:
key - the key of the annotation
Returns:
the annotation with the specified key

getAnnotation

public FileAnnotation getAnnotation(java.lang.String key)
Returns the annotation with the specified key.

Specified by:
getAnnotation in interface AnnotationProvider
Parameters:
key - the key of the annotation as a long value in string representation
Returns:
the annotation with the specified key

getAnnotations

public java.util.Collection<FileAnnotation> getAnnotations(Priority priority)
Returns the annotations of the specified priority for this object.

Specified by:
getAnnotations in interface AnnotationProvider
Parameters:
priority - the priority
Returns:
annotations of the specified priority for this object

getAnnotations

public java.util.Collection<FileAnnotation> getAnnotations(java.lang.String priority)
Returns the annotations of the specified priority for this object.

Specified by:
getAnnotations in interface AnnotationProvider
Parameters:
priority - the priority as a string object
Returns:
annotations of the specified priority for this object

getNumberOfAnnotations

public int getNumberOfAnnotations(java.lang.String priority)
Returns the annotations of the specified priority for this object.

Specified by:
getNumberOfAnnotations in interface AnnotationProvider
Parameters:
priority - the priority as a string object
Returns:
annotations of the specified priority for this object

getContainer

public abstract AnnotationContainer getContainer()
Gets the annotation container.

Returns:
the container


Copyright © 2009. All Rights Reserved.