Files
maven-plugins/xdoc/src/main/org/apache/maven/DescribedDependency.java
T
2007-04-25 12:28:56 +00:00

242 lines
5.1 KiB
Java

package org.apache.maven;
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import org.apache.maven.project.Dependency;
/**
* Dependency wrapper. Adds an url to download and a description.
*
* @author <a href="mailto:michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
*/
public class DescribedDependency implements Comparable
{
//~ Instance fields ----------------------------------------------------------
/** Original dependency. */
private Dependency dependency;
/** Dependency description. */
private String description = null;
/** Dependency Url. */
private String url = null;
//~ Constructors -------------------------------------------------------------
/**
* Creates a new DescribedDependency object.
*
* @param dependencyToWrap Original dependency.
*/
public DescribedDependency(Dependency dependencyToWrap)
{
this.dependency = dependencyToWrap;
}
//~ Methods ------------------------------------------------------------------
/**
* Dependency's artifact property getter.
*
* @return dependency's artifact.
*
* @see Dependency#getArtifact()
*/
public String getArtifact()
{
return dependency.getArtifact();
}
/**
* Dependency's artifactDirectory property getter.
*
* @return dependency's artifactDirectory.
*
* @see Dependency#getArtifactDirectory()
*/
public String getArtifactDirectory()
{
return dependency.getArtifactDirectory();
}
/**
* Dependency's artifactId property getter.
*
* @return dependency's artifactId.
*
* @see Dependency#getArtifactId()
*/
public String getArtifactId()
{
return dependency.getArtifactId();
}
/**
* Property setter.
*
* @param newDescription new description for the dependency.
*
*/
public void setDescription(String newDescription)
{
this.description = newDescription;
}
/**
* Property getter.
*
* @return the dependency's description.
*
*/
public String getDescription()
{
return description;
}
/**
* Dependency's extension property getter.
*
* @return dependency's extension.
*
* @see Dependency#getExtension()
*/
public String getExtension()
{
return dependency.getExtension();
}
/**
* Dependency's groupId property getter.
*
* @return dependency's groupId.
*
* @see Dependency#getGroupId()
*/
public String getGroupId()
{
return dependency.getGroupId();
}
/**
* Dependency's id property getter.
*
* @return dependency's id.
*
* @see Dependency#getId()
*/
public String getId()
{
return dependency.getId();
}
/**
* Dependency's jar property getter.
*
* @return dependency's jar.
*
* @see Dependency#getJar()
*/
public String getJar()
{
return dependency.getJar();
}
/**
* Dependency's type property getter.
*
* @return dependency's type.
*
* @see Dependency#getType()
*/
public String getType()
{
return dependency.getType();
}
/**
* Property setter.
*
* @param newUrl the new dependency's url.
*/
public void setUrl(String newUrl)
{
this.url = newUrl;
}
/**
* Property getter.
*
* @return the dependency's url.
*/
public String getUrl()
{
String retValue;
if ((dependency.getUrl() != null) && (dependency.getUrl().length() > 0))
{
retValue = dependency.getUrl();
}
else
{
retValue = url;
}
return retValue;
}
/**
* Dependency's version property getter.
*
* @return dependency's version.
*
* @see Dependency#getVersion()
*/
public String getVersion()
{
return dependency.getVersion();
}
/**
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public int compareTo(Object obj)
{
DescribedDependency other = (DescribedDependency) obj;
return this.getId().compareTo(other.getId());
}
/**
* Delegate method from Dependency.getProperty("comment")
*/
public String getComment() {
return dependency.getProperty("comment");
}
/**
* Delegate method from Dependency.getProperty("scope")
*/
public String getScope()
{
return dependency.getProperty("scope");
}
}