hudson.plugins.pmd.util.FileDetail Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pmd Show documentation
Show all versions of pmd Show documentation
This plug-in generates the trend report for PMD, an
open source static code analysis program.
package hudson.plugins.pmd.util;
import hudson.model.AbstractBuild;
import hudson.plugins.pmd.util.model.WorkspaceFile;
import java.util.ArrayList;
import java.util.Collection;
/**
* Result object to visualize the package statistics of a module.
*
* @author Ulli Hafner
*/
public class FileDetail extends AbstractAnnotationsDetail {
/** Unique identifier of this class. */
private static final long serialVersionUID = -5315146140343619856L;
/** The package to show the details for. */
private final WorkspaceFile file;
/**
* Creates a new instance of ModuleDetail
.
*
* @param owner
* current build as owner of this action.
* @param file
* the file to show the details for
* @param defaultEncoding
* the default encoding to be used when reading and parsing files
* @param header
* header to be shown on detail page
*/
public FileDetail(final AbstractBuild owner, final WorkspaceFile file, final String defaultEncoding, final String header) {
super(owner, file.getAnnotations(), defaultEncoding, header, Hierarchy.FILE);
this.file = file;
}
/**
* Returns the header for the detail screen.
*
* @return the header
*/
@Override
public String getHeader() {
return getName() + " - File " + file.getShortName();
}
/** {@inheritDoc} */
public String getDisplayName() {
return file.getShortName();
}
/** {@inheritDoc} */
@Override
public Collection getFiles() {
ArrayList files = new ArrayList();
files.add(file);
return files;
}
/** {@inheritDoc} */
@Override
public WorkspaceFile getFile(final int hashCode) {
return file;
}
/** {@inheritDoc} */
@Override
public WorkspaceFile getFile(final String name) {
return file;
}
}