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