1 package org.apache.maven.archiva.plugins.dev.functors;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.commons.collections.Predicate;
23 import org.apache.maven.model.Dependency;
24 import org.codehaus.plexus.util.StringUtils;
27 * MatchingDependencyPredicate
29 * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
32 public class MatchingDependencyPredicate
35 private Dependency selectedDep;
37 public MatchingDependencyPredicate( Dependency selectedDep )
39 this.selectedDep = selectedDep;
42 public boolean evaluate( Object input )
44 boolean satisfies = false;
46 if ( input instanceof Dependency )
48 Dependency dep = (Dependency) input;
49 if ( StringUtils.equals( dep.getArtifactId(), selectedDep.getArtifactId() )
50 && StringUtils.equals( dep.getGroupId(), selectedDep.getGroupId() )
51 && StringUtils.equals( dep.getType(), selectedDep.getType() ))
53 // So far, so good. groupId/artifactId/type match.
56 // Test classifier (if defined)
57 if( StringUtils.isNotEmpty( selectedDep.getClassifier() ) )
59 satisfies = StringUtils.equals( dep.getClassifier(), selectedDep.getClassifier() );