* @return true if the version is contained by the range.
*/
public static boolean containsVersion( VersionRange allowedRange, ArtifactVersion theVersion )
{
boolean matched = false;
ArtifactVersion recommendedVersion = allowedRange.getRecommendedVersion();
if ( recommendedVersion == null )
{
@SuppressWarnings( "unchecked" )
List<Restriction> restrictions = allowedRange.getRestrictions();
for ( Restriction restriction : restrictions )
{
if ( restriction.containsVersion( theVersion ) )
{
matched = true;
break;
}
}
}
else
{
// only singular versions ever have a recommendedVersion
@SuppressWarnings( "unchecked" )
int compareTo = recommendedVersion.compareTo( theVersion );
matched = ( compareTo <= 0 );
}
return matched;
}