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