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  
36      public KnownHostEntry( String hostName, String keyType, String keyValue )
37      {
38          this.hostName = hostName;
39          this.keyType = keyType;
40          this.keyValue = keyValue;
41      }
42  
43      public String getHostName()
44      {
45          return hostName;
46      }
47  
48      public void setHostName( String hostName )
49      {
50          this.hostName = hostName;
51      }
52  
53      public String getKeyType()
54      {
55          return keyType;
56      }
57  
58      public void setKeyType( String keyType )
59      {
60          this.keyType = keyType;
61      }
62  
63      public String getKeyValue()
64      {
65          return keyValue;
66      }
67  
68      public void setKeyValue( String keyValue )
69      {
70          this.keyValue = keyValue;
71      }
72  
73      public int hashCode()
74      {
75          final int prime = 31;
76          int result = 1;
77          result = prime * result + ( ( hostName == null ) ? 0 : hostName.hashCode() );
78          result = prime * result + ( ( keyType == null ) ? 0 : keyType.hashCode() );
79          result = prime * result + ( ( keyValue == null ) ? 0 : keyValue.hashCode() );
80          return result;
81      }
82  
83      public boolean equals( Object obj )
84      {
85          if ( this == obj )
86              return true;
87          if ( obj == null )
88              return false;
89          if ( getClass() != obj.getClass() )
90              return false;
91          KnownHostEntry other = (KnownHostEntry) obj;
92          if ( hostName == null )
93          {
94              if ( other.hostName != null )
95                  return false;
96          }
97          else if ( !hostName.equals( other.hostName ) )
98              return false;
99          if ( keyType == null )
100         {
101             if ( other.keyType != null )
102                 return false;
103         }
104         else if ( !keyType.equals( other.keyType ) )
105             return false;
106         if ( keyValue == null )
107         {
108             if ( other.keyValue != null )
109                 return false;
110         }
111         else if ( !keyValue.equals( other.keyValue ) )
112             return false;
113         return true;
114     }
115 
116 }