org.codehaus.mojo.versions.api
Class PropertyVersions

java.lang.Object
  extended by org.codehaus.mojo.versions.api.PropertyVersions

public class PropertyVersions
extends Object

Manages a property that is associated with one or more artifacts.

Since:
1.0-alpha-3
Author:
Stephen Connolly

Constructor Summary
PropertyVersions(String profileId, String name, VersionsHelper helper)
          Constructs a new PropertyVersions.
 
Method Summary
 void addAssociation(Artifact artifact, boolean usePluginRepositories)
           
 void clearAssociations()
           
 int compare(ArtifactVersion v1, ArtifactVersion v2)
           
 ArtifactAssocation[] getAssociations()
           
 String getName()
           
 String getProfileId()
           
 ArtifactVersion[] getVersions(boolean includeSnapshots)
          Uses the DefaultVersionsHelper to find all available versions that match all the associations with this property.
 ArtifactVersion[] getVersions(Collection artifacts)
          Uses the supplied Collection of Artifact instances to see if an ArtifactVersion can be provided.
 boolean isAssociated()
           
 void removeAssociation(Artifact artifact, boolean usePluginRepositories)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyVersions

public PropertyVersions(String profileId,
                        String name,
                        VersionsHelper helper)
Constructs a new PropertyVersions.

Parameters:
profileId -
name - The property name.
helper - The DefaultVersionsHelper.
Method Detail

addAssociation

public void addAssociation(Artifact artifact,
                           boolean usePluginRepositories)

removeAssociation

public void removeAssociation(Artifact artifact,
                              boolean usePluginRepositories)

getAssociations

public ArtifactAssocation[] getAssociations()

compare

public int compare(ArtifactVersion v1,
                   ArtifactVersion v2)
            throws MojoExecutionException
Throws:
MojoExecutionException

getVersions

public ArtifactVersion[] getVersions(Collection artifacts)
                              throws MojoExecutionException
Uses the supplied Collection of Artifact instances to see if an ArtifactVersion can be provided.

Parameters:
artifacts - The Collection of Artifact instances .
Returns:
The versions that can be resolved from the supplied Artifact instances or an empty array if no version can be resolved (i.e. the property is not associated with any of the supplied artifacts or the property is also associated to an artifact that has not been provided).
Throws:
MojoExecutionException
Since:
1.0-alpha-3

getVersions

public ArtifactVersion[] getVersions(boolean includeSnapshots)
                              throws MojoExecutionException
Uses the DefaultVersionsHelper to find all available versions that match all the associations with this property.

Parameters:
includeSnapshots - Whether to include snapshot versions in our search.
Returns:
The (possibly empty) array of versions.
Throws:
MojoExecutionException

getName

public String getName()

getProfileId

public String getProfileId()

isAssociated

public boolean isAssociated()

toString

public String toString()
Overrides:
toString in class Object

clearAssociations

public void clearAssociations()


Copyright © 2008-2009 Codehaus. All Rights Reserved.