1 package org.apache.maven.plugin.war.util; 2 3 /* 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 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 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 19 * under the License. 20 */ 21 22 import org.apache.maven.model.Dependency; 23 24 /** 25 * Holds a dependency and packaging information. 26 * 27 * @author Stephane Nicoll 28 * @version $Id: DependencyInfo.html 925069 2014-10-08 17:03:57Z khmarbaise $ 29 */ 30 public class DependencyInfo 31 { 32 33 private final Dependency dependency; 34 35 private String targetFileName; 36 37 /** 38 * Creates a new instance. 39 * 40 * @param dependency the dependency 41 */ 42 public DependencyInfo( Dependency dependency ) 43 { 44 this.dependency = dependency; 45 } 46 47 /** 48 * Returns the dependency. 49 * 50 * @return the dependency 51 */ 52 public Dependency getDependency() 53 { 54 return dependency; 55 } 56 57 /** 58 * Returns the target filen ame of the dependency. If no target file name is associated, returns <tt>null</tt>. 59 * 60 * @return the target file name or <tt>null</tt> 61 */ 62 public String getTargetFileName() 63 { 64 return targetFileName; 65 } 66 67 /** 68 * Sets the target file name. 69 * 70 * @param targetFileName the target file name 71 */ 72 public void setTargetFileName( String targetFileName ) 73 { 74 this.targetFileName = targetFileName; 75 } 76 77 public boolean equals( Object o ) 78 { 79 if ( this == o ) 80 { 81 return true; 82 } 83 if ( o == null || getClass() != o.getClass() ) 84 { 85 return false; 86 } 87 88 DependencyInfo that = (DependencyInfo) o; 89 90 if ( dependency != null ? !dependency.equals( that.dependency ) : that.dependency != null ) 91 { 92 return false; 93 } 94 95 return true; 96 } 97 98 public int hashCode() 99 { 100 int result; 101 result = ( dependency != null ? dependency.hashCode() : 0 ); 102 result = 31 * result + ( targetFileName != null ? targetFileName.hashCode() : 0 ); 103 return result; 104 } 105 }