1 | |
package org.apache.maven.wagon.resource; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.wagon.WagonConstants; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
public class Resource |
36 | |
{ |
37 | |
private String name; |
38 | |
|
39 | |
private long lastModified; |
40 | |
|
41 | 33 | private long contentLength = WagonConstants.UNKNOWN_LENGTH; |
42 | |
|
43 | |
public Resource() |
44 | 2 | { |
45 | |
|
46 | 2 | } |
47 | |
|
48 | |
public Resource( String name ) |
49 | 31 | { |
50 | 31 | this.name = name; |
51 | 31 | } |
52 | |
|
53 | |
public String getName() |
54 | |
{ |
55 | 9 | return name; |
56 | |
} |
57 | |
|
58 | |
public void setName( String name ) |
59 | |
{ |
60 | 3 | this.name = name; |
61 | 3 | } |
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
public long getLastModified() |
71 | |
{ |
72 | 9 | return lastModified; |
73 | |
} |
74 | |
|
75 | |
public void setLastModified( long lastModified ) |
76 | |
{ |
77 | 20 | this.lastModified = lastModified; |
78 | 20 | } |
79 | |
|
80 | |
public long getContentLength() |
81 | |
{ |
82 | 3 | return contentLength; |
83 | |
} |
84 | |
|
85 | |
public void setContentLength( long contentLength ) |
86 | |
{ |
87 | 4 | this.contentLength = contentLength; |
88 | 4 | } |
89 | |
|
90 | |
public String toString() |
91 | |
{ |
92 | 3 | return name; |
93 | |
} |
94 | |
|
95 | |
public String inspect() |
96 | |
{ |
97 | 0 | return name + "[len = " + contentLength + "; mod = " + lastModified + "]"; |
98 | |
} |
99 | |
|
100 | |
public int hashCode() |
101 | |
{ |
102 | 0 | final int prime = 31; |
103 | 0 | int result = 1; |
104 | 0 | result = prime * result + (int) ( contentLength ^ ( contentLength >>> 32 ) ); |
105 | 0 | result = prime * result + (int) ( lastModified ^ ( lastModified >>> 32 ) ); |
106 | 0 | result = prime * result + ( ( name == null ) ? 0 : name.hashCode() ); |
107 | 0 | return result; |
108 | |
} |
109 | |
|
110 | |
public boolean equals( Object obj ) |
111 | |
{ |
112 | 7 | if ( this == obj ) |
113 | |
{ |
114 | 1 | return true; |
115 | |
} |
116 | 6 | if ( obj == null ) |
117 | |
{ |
118 | 0 | return false; |
119 | |
} |
120 | 6 | if ( getClass() != obj.getClass() ) |
121 | |
{ |
122 | 0 | return false; |
123 | |
} |
124 | 6 | final Resource other = (Resource) obj; |
125 | 6 | if ( contentLength != other.contentLength ) |
126 | |
{ |
127 | 0 | return false; |
128 | |
} |
129 | 6 | if ( lastModified != other.lastModified ) |
130 | |
{ |
131 | 0 | return false; |
132 | |
} |
133 | 6 | if ( name == null ) |
134 | |
{ |
135 | 0 | if ( other.name != null ) |
136 | |
{ |
137 | 0 | return false; |
138 | |
} |
139 | |
} |
140 | 6 | else if ( !name.equals( other.name ) ) |
141 | |
{ |
142 | 0 | return false; |
143 | |
} |
144 | 6 | return true; |
145 | |
} |
146 | |
} |