hudson.plugins.tasks.util.model
Class AnnotationContainer

java.lang.Object
  extended by hudson.plugins.tasks.util.model.AnnotationContainer
All Implemented Interfaces:
AnnotationProvider, java.io.Serializable
Direct Known Subclasses:
AbstractAnnotationsDetail, DefaultAnnotationContainer, JavaPackage, JavaProject, MavenModule, WorkspaceFile

public abstract class AnnotationContainer
extends java.lang.Object
implements AnnotationProvider, java.io.Serializable

A container for annotations.

Author:
Ulli Hafner
See Also:
Serialized Form

Nested Class Summary
static class AnnotationContainer.Hierarchy
          The hierarchy of a container.
 
Constructor Summary
  AnnotationContainer(AnnotationContainer.Hierarchy hierarchy)
          Creates a new instance of AnnotationContainer.
protected AnnotationContainer(java.lang.String name, AnnotationContainer.Hierarchy hierarchy)
          Creates a new instance of AnnotationContainer.
 
Method Summary
 void addAnnotation(FileAnnotation annotation)
          Adds the specified annotation to this container.
 void addAnnotations(java.util.Collection<? extends FileAnnotation> newAnnotations)
          Adds the specified annotations to this container.
 void addAnnotations(FileAnnotation[] newAnnotations)
          Adds the specified annotations to this container.
 boolean containsCategory(java.lang.String category)
          Returns whether the category with the given name exists.
 boolean containsFile(java.lang.String fileName)
          Returns whether the file with the given name exists.
 boolean containsModule(java.lang.String moduleName)
          Returns whether the maven module with the given name exists.
 boolean containsPackage(java.lang.String packageName)
          Returns whether the package with the given name exists.
 boolean containsType(java.lang.String type)
          Returns whether the type with the given name exists.
 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.
 java.util.Collection<AnnotationContainer> getCategories()
          Gets the categories of this container that have annotations.
 DefaultAnnotationContainer getCategory(java.lang.String category)
          Gets the category with the given name.
 AnnotationContainer getContainer()
          Returns this container.
 WorkspaceFile getFile(int hashCode)
          Gets the file with the given hash code.
 WorkspaceFile getFile(java.lang.String fileName)
          Gets the file with the given name.
 java.util.Collection<WorkspaceFile> getFiles()
          Gets the files of this container that have annotations.
 java.util.Collection<FileAnnotation> getHighAnnotations()
          Returns the annotations with Priority.HIGH.
 Priority getHighPriority()
          Returns Priority.HIGH.
 java.util.Collection<FileAnnotation> getLowAnnotations()
          Returns the annotations with Priority.LOW.
 Priority getLowPriority()
          Returns Priority.LOW.
 MavenModule getModule(java.lang.String moduleName)
          Gets the module with the given name.
 java.util.Collection<MavenModule> getModules()
          Gets the modules of this container that have annotations.
 java.lang.String getName()
          Returns the name of this container.
 java.util.Collection<FileAnnotation> getNormalAnnotations()
          Returns the annotations with Priority.NORMAL.
 Priority getNormalPriority()
          Returns Priority.NORMAL.
 int getNumberOfAnnotations()
          Returns the total number of annotations for this object.
 int getNumberOfAnnotations(Priority priority)
          Returns the total number of annotations of the specified priority for this object.
 int getNumberOfAnnotations(java.lang.String priority)
          Returns the annotations of the specified priority for this object.
 JavaPackage getPackage(java.lang.String packageName)
          Gets the package with the given name.
 java.lang.String getPackageCategoryName()
          Returns the package category name for the scanned files.
 java.util.Collection<JavaPackage> getPackages()
          Gets the packages of this container that have annotations.
 java.lang.String getToolTip()
          Returns a tooltip showing the distribution of priorities for this container.
 DefaultAnnotationContainer getType(java.lang.String type)
          Gets the type with the given name.
 java.util.Collection<AnnotationContainer> getTypes()
          Gets the types of this container that have 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 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.
protected  void rebuildMappings()
          Rebuilds the priorities and files after deserialization.
protected  void setHierarchy(AnnotationContainer.Hierarchy hierarchy)
          Sets the hierarchy to the specified value.
 void setName(java.lang.String name)
          Sets the name of this container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationContainer

public AnnotationContainer(AnnotationContainer.Hierarchy hierarchy)
Creates a new instance of AnnotationContainer.

Parameters:
hierarchy - the hierarchy of this container

AnnotationContainer

protected AnnotationContainer(java.lang.String name,
                              AnnotationContainer.Hierarchy hierarchy)
Creates a new instance of AnnotationContainer.

Parameters:
name - the name of this container
hierarchy - the hierarchy of this container
Method Detail

getContainer

public AnnotationContainer getContainer()
Returns this container.

Returns:
this container

setHierarchy

protected void setHierarchy(AnnotationContainer.Hierarchy hierarchy)
Sets the hierarchy to the specified value.

Parameters:
hierarchy - the value to set

getName

public final java.lang.String getName()
Returns the name of this container.

Returns:
the name of this container

setName

public final void setName(java.lang.String name)
Sets the name of this container.

Parameters:
name - the name of this container

rebuildMappings

protected void rebuildMappings()
Rebuilds the priorities and files after deserialization.


addAnnotation

public final void addAnnotation(FileAnnotation annotation)
Adds the specified annotation to this container.

Parameters:
annotation - the annotation to add

addAnnotations

public final void addAnnotations(java.util.Collection<? extends FileAnnotation> newAnnotations)
Adds the specified annotations to this container.

Parameters:
newAnnotations - the annotations to add

addAnnotations

public final void addAnnotations(FileAnnotation[] newAnnotations)
Adds the specified annotations to this container.

Parameters:
newAnnotations - the annotations to add

getAnnotations

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

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

getAnnotations

public final 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

getHighAnnotations

public final java.util.Collection<FileAnnotation> getHighAnnotations()
Returns the annotations with Priority.HIGH.

Returns:
the annotations with Priority.HIGH

getNormalAnnotations

public final java.util.Collection<FileAnnotation> getNormalAnnotations()
Returns the annotations with Priority.NORMAL.

Returns:
the annotations with Priority.NORMAL

getLowAnnotations

public final java.util.Collection<FileAnnotation> getLowAnnotations()
Returns the annotations with Priority.LOW.

Returns:
the annotations with Priority.LOW

getAnnotations

public final 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()
Returns the total number of annotations for this object.

Specified by:
getNumberOfAnnotations in interface AnnotationProvider
Returns:
total number of annotations for this object

getNumberOfAnnotations

public int getNumberOfAnnotations(Priority priority)
Returns the total number of annotations of the specified priority for this object.

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

getNumberOfAnnotations

public final 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

hasAnnotations

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

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

hasAnnotations

public final 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 final 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.

hasNoAnnotations

public final 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 final 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 final 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.

getAnnotation

public final 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 final 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

getToolTip

public java.lang.String getToolTip()
Returns a tooltip showing the distribution of priorities for this container.

Returns:
a tooltip showing the distribution of priorities

getPackageCategoryName

public final java.lang.String getPackageCategoryName()
Returns the package category name for the scanned files. Currently, only java and c# files are supported.

Returns:
the package category name for the scanned files

getModules

public java.util.Collection<MavenModule> getModules()
Gets the modules of this container that have annotations.

Returns:
the modules with annotations

containsModule

public boolean containsModule(java.lang.String moduleName)
Returns whether the maven module with the given name exists.

Parameters:
moduleName - the module to check for
Returns:
true if the maven module with the given name exists, false otherwise

getModule

public MavenModule getModule(java.lang.String moduleName)
Gets the module with the given name.

Parameters:
moduleName - the name of the module
Returns:
the module with the given name

getPackages

public java.util.Collection<JavaPackage> getPackages()
Gets the packages of this container that have annotations.

Returns:
the packages with annotations

containsPackage

public boolean containsPackage(java.lang.String packageName)
Returns whether the package with the given name exists.

Parameters:
packageName - the package to check for
Returns:
true if the package with the given name exists, false otherwise

getPackage

public JavaPackage getPackage(java.lang.String packageName)
Gets the package with the given name.

Parameters:
packageName - the name of the package
Returns:
the file with the given name

getFiles

public java.util.Collection<WorkspaceFile> getFiles()
Gets the files of this container that have annotations.

Returns:
the files with annotations

containsFile

public boolean containsFile(java.lang.String fileName)
Returns whether the file with the given name exists.

Parameters:
fileName - the file to check for
Returns:
true if the file with the given name exists, false otherwise

getFile

public WorkspaceFile getFile(java.lang.String fileName)
Gets the file with the given name.

Parameters:
fileName - the short name of the file
Returns:
the file with the given name

getFile

public WorkspaceFile getFile(int hashCode)
Gets the file with the given hash code.

Parameters:
hashCode - the hash code of the file
Returns:
the file with the given name

getCategories

public java.util.Collection<AnnotationContainer> getCategories()
Gets the categories of this container that have annotations.

Returns:
the categories with annotations

containsCategory

public boolean containsCategory(java.lang.String category)
Returns whether the category with the given name exists.

Parameters:
category - the file to check for
Returns:
true if the category with the given name exists, false otherwise

getCategory

public DefaultAnnotationContainer getCategory(java.lang.String category)
Gets the category with the given name.

Parameters:
category - the category name
Returns:
the category with the given name

getTypes

public java.util.Collection<AnnotationContainer> getTypes()
Gets the types of this container that have annotations.

Returns:
the types with annotations

containsType

public boolean containsType(java.lang.String type)
Returns whether the type with the given name exists.

Parameters:
type - the type to check for
Returns:
true if the type with the given name exists, false otherwise

getType

public DefaultAnnotationContainer getType(java.lang.String type)
Gets the type with the given name.

Parameters:
type - the type name
Returns:
the type with the given name

getHighPriority

public Priority getHighPriority()
Returns Priority.HIGH.

Returns:
Priority.HIGH

getNormalPriority

public Priority getNormalPriority()
Returns Priority.NORMAL.

Returns:
Priority.NORMAL

getLowPriority

public Priority getLowPriority()
Returns Priority.LOW.

Returns:
Priority.LOW


Copyright © 2008. All Rights Reserved.