View Javadoc

1   package org.apache.maven.wagon.providers.ssh.knownhost;
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  public class KnownHostEntry
23  {
24  
25      private String hostName;
26  
27      private String keyType;
28  
29      private String keyValue;
30  
31      public KnownHostEntry()
32      {
33      }
34  
35      public KnownHostEntry( String hostName, String keyType, String keyValue )
36      {
37          this.hostName = hostName;
38          this.keyType = keyType;
39          this.keyValue = keyValue;
40      }
41  
42      public String getHostName()
43      {
44          return hostName;
45      }
46  
47      public void setHostName( String hostName )
48      {
49          this.hostName = hostName;
50      }
51  
52      public String getKeyType()
53      {
54          return keyType;
55      }
56  
57      public void setKeyType( String keyType )
58      {
59          this.keyType = keyType;
60      }
61  
62      public String getKeyValue()
63      {
64          return keyValue;
65      }
66  
67      public void setKeyValue( String keyValue )
68      {
69          this.keyValue = keyValue;
70      }
71  
72      public int hashCode()
73      {
74          final int prime = 31;
75          int result = 1;
76          result = prime * result + ( ( hostName == null ) ? 0 : hostName.hashCode() );
77          result = prime * result + ( ( keyType == null ) ? 0 : keyType.hashCode() );
78          result = prime * result + ( ( keyValue == null ) ? 0 : keyValue.hashCode() );
79          return result;
80      }
81  
82      public boolean equals( Object obj )
83      {
84          if ( this == obj )
85          {
86              return true;
87          }
88  
89          if ( obj == null )
90          {
91              return false;
92          }
93  
94          if ( getClass() != obj.getClass() )
95          {
96              return false;
97          }
98  
99          KnownHostEntry other = (KnownHostEntry) obj;
100         if ( hostName == null )
101         {
102             if ( other.hostName != null )
103             {
104                 return false;
105             }
106         }
107         else if ( !hostName.equals( other.hostName ) )
108         {
109             return false;
110         }
111 
112         if ( keyType == null )
113         {
114             if ( other.keyType != null )
115             {
116                 return false;
117             }
118         }
119         else if ( !keyType.equals( other.keyType ) )
120         {
121             return false;
122         }
123 
124         if ( keyValue == null )
125         {
126             if ( other.keyValue != null )
127             {
128                 return false;
129             }
130         }
131         else if ( !keyValue.equals( other.keyValue ) )
132         {
133             return false;
134         }
135         return true;
136     }
137 
138 }