little coding style fixes (no code change)

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@804533 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Herve Boutemy 2009-08-15 22:08:43 +00:00
parent 828db37251
commit 10c3b8f499
5 changed files with 33 additions and 28 deletions

View File

@ -39,15 +39,15 @@ public abstract class DefaultToolchain
private Map<String, RequirementMatcher> provides = new HashMap<String, RequirementMatcher>();
public static final String KEY_TYPE = "type"; //NOI18N
private ToolchainModel model;
private Logger logger;
protected DefaultToolchain( ToolchainModel model, Logger logger )
protected DefaultToolchain( ToolchainModel model, Logger logger )
{
this.model = model;
this.logger = logger;
}
@ -57,13 +57,13 @@ public abstract class DefaultToolchain
this.type = type;
}
public final String getType( )
public final String getType()
{
return type != null ? type : model.getType();
}
public final ToolchainModel getModel( )
public final ToolchainModel getModel()
{
return model;
}
@ -75,14 +75,15 @@ public abstract class DefaultToolchain
}
public boolean matchesRequirements(Map requirements) {
public boolean matchesRequirements(Map requirements)
{
Iterator it = requirements.keySet().iterator();
while ( it.hasNext() )
{
String key = (String) it.next();
RequirementMatcher matcher = provides.get( key );
if ( matcher == null )
{
getLog().debug( "Toolchain " + this + " is missing required property: " + key );
@ -96,8 +97,9 @@ public abstract class DefaultToolchain
}
return true;
}
protected Logger getLog() {
protected Logger getLog()
{
return logger;
}
}

View File

@ -29,7 +29,7 @@ import org.apache.maven.artifact.versioning.VersionRange;
*/
public final class RequirementMatcherFactory
{
private RequirementMatcherFactory( )
private RequirementMatcherFactory()
{
}
@ -68,21 +68,24 @@ public final class RequirementMatcherFactory
private VersionMatcher( String version )
{
this.version = new DefaultArtifactVersion(version);
this.version = new DefaultArtifactVersion( version );
}
public boolean matches( String requirement )
{
try
try
{
VersionRange range = VersionRange.createFromVersionSpec(requirement);
if (range.hasRestrictions()) {
return range.containsVersion(version);
} else {
return range.getRecommendedVersion().compareTo(version) == 0;
VersionRange range = VersionRange.createFromVersionSpec( requirement );
if ( range.hasRestrictions() )
{
return range.containsVersion( version );
}
}
catch (InvalidVersionSpecificationException ex)
else
{
return range.getRecommendedVersion().compareTo( version ) == 0;
}
}
catch ( InvalidVersionSpecificationException ex )
{
//TODO error reporting
ex.printStackTrace();

View File

@ -27,7 +27,7 @@ package org.apache.maven.toolchain;
public interface Toolchain
{
String getType( );
String getType();
/**
* Gets the platform tool executable.

View File

@ -38,5 +38,5 @@ public interface ToolchainFactory
* if not applicable.
* TODO keep around??
**/
ToolchainPrivate createDefaultToolchain( );
ToolchainPrivate createDefaultToolchain();
}

View File

@ -37,8 +37,8 @@ public interface ToolchainPrivate
* @param requirements Map<String, String> key value pair
* @return
*/
boolean matchesRequirements( Map requirements);
ToolchainModel getModel( );
boolean matchesRequirements( Map requirements );
ToolchainModel getModel();
}