Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
LinkValidationItem |
|
| 3.0;3 |
1 | package org.apache.maven.doxia.linkcheck.validation; | |
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 java.io.File; | |
23 | ||
24 | /** | |
25 | * @author <a href="mailto:bwalding@apache.org">Ben Walding</a> | |
26 | * @author <a href="mailto:aheritier@apache.org">Arnaud Heritier</a> | |
27 | * @version $Id: LinkValidationItem.java 786979 2009-06-21 09:59:38Z ltheussl $ | |
28 | */ | |
29 | public class LinkValidationItem | |
30 | { | |
31 | /** The source file. */ | |
32 | private final File source; | |
33 | ||
34 | /** The link. */ | |
35 | private final String link; | |
36 | ||
37 | /** | |
38 | * Constructor: initializes the source and link. | |
39 | * | |
40 | * @param src The source file, cannot be null. | |
41 | * @param lnk The link, cannot be null. | |
42 | */ | |
43 | public LinkValidationItem( File src, String lnk ) | |
44 | 1636 | { |
45 | 1636 | if ( src == null ) |
46 | { | |
47 | 0 | throw new NullPointerException( "source can't be null" ); |
48 | } | |
49 | ||
50 | 1636 | if ( lnk == null ) |
51 | { | |
52 | 0 | throw new NullPointerException( "link can't be null" ); |
53 | } | |
54 | ||
55 | 1636 | this.source = src; |
56 | 1636 | this.link = lnk; |
57 | 1636 | } |
58 | ||
59 | /** | |
60 | * Returns the link. | |
61 | * | |
62 | * @return String | |
63 | */ | |
64 | public String getLink() | |
65 | { | |
66 | 18444 | return this.link; |
67 | } | |
68 | ||
69 | /** | |
70 | * Returns the source file. | |
71 | * | |
72 | * @return File | |
73 | */ | |
74 | public File getSource() | |
75 | { | |
76 | 4840 | return this.source; |
77 | } | |
78 | ||
79 | /** {@inheritDoc} */ | |
80 | public boolean equals( Object obj ) | |
81 | { | |
82 | 0 | if ( !( obj instanceof LinkValidationItem ) ) |
83 | { | |
84 | 0 | return false; |
85 | } | |
86 | ||
87 | 0 | LinkValidationItem lvi = (LinkValidationItem) obj; |
88 | ||
89 | 0 | if ( !lvi.link.equals( this.link ) ) |
90 | { | |
91 | 0 | return false; |
92 | } | |
93 | ||
94 | 0 | if ( !lvi.source.equals( this.source ) ) |
95 | { | |
96 | 0 | return false; |
97 | } | |
98 | ||
99 | 0 | return true; |
100 | } | |
101 | ||
102 | /** {@inheritDoc} */ | |
103 | public int hashCode() | |
104 | { | |
105 | 0 | return this.source.hashCode() ^ this.link.hashCode(); |
106 | } | |
107 | ||
108 | } |