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 private long contentLength = WagonConstants.UNKNOWN_LENGTH;
42
43 public Resource()
44 {
45
46 }
47
48 public Resource( String name )
49 {
50 this.name = name;
51 }
52
53 public String getName()
54 {
55 return name;
56 }
57
58 public void setName( String name )
59 {
60 this.name = name;
61 }
62
63
64
65
66
67
68
69
70 public long getLastModified()
71 {
72 return lastModified;
73 }
74
75 public void setLastModified( long lastModified )
76 {
77 this.lastModified = lastModified;
78 }
79
80 public long getContentLength()
81 {
82 return contentLength;
83 }
84
85 public void setContentLength( long contentLength )
86 {
87 this.contentLength = contentLength;
88 }
89
90 public String toString()
91 {
92 return name;
93 }
94
95 public String inspect()
96 {
97 return name + "[len = " + contentLength + "; mod = " + lastModified + "]";
98 }
99
100 public int hashCode()
101 {
102 final int prime = 31;
103 int result = 1;
104 result = prime * result + (int) ( contentLength ^ ( contentLength >>> 32 ) );
105 result = prime * result + (int) ( lastModified ^ ( lastModified >>> 32 ) );
106 result = prime * result + ( ( name == null ) ? 0 : name.hashCode() );
107 return result;
108 }
109
110 public boolean equals( Object obj )
111 {
112 if ( this == obj )
113 {
114 return true;
115 }
116 if ( obj == null )
117 {
118 return false;
119 }
120 if ( getClass() != obj.getClass() )
121 {
122 return false;
123 }
124 final Resource other = (Resource) obj;
125 if ( contentLength != other.contentLength )
126 {
127 return false;
128 }
129 if ( lastModified != other.lastModified )
130 {
131 return false;
132 }
133 if ( name == null )
134 {
135 if ( other.name != null )
136 {
137 return false;
138 }
139 }
140 else if ( !name.equals( other.name ) )
141 {
142 return false;
143 }
144 return true;
145 }
146 }