View Javadoc
1   /*
2    * Copyright 2013-2020 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.cloud.contract.maven.verifier;
18  
19  /**
20   * Represents a single mapping of regex on package where contracts reside to the FQN of
21   * the base test class.
22   *
23   * @author Marcin Grzejszczak
24   * @since 1.0.0
25   */
26  public class BaseClassMapping {
27  
28  	private String contractPackageRegex;
29  
30  	private String baseClassFQN;
31  
32  	public String getContractPackageRegex() {
33  		return this.contractPackageRegex;
34  	}
35  
36  	public void setContractPackageRegex(String contractPackageRegex) {
37  		this.contractPackageRegex = contractPackageRegex;
38  	}
39  
40  	public String getBaseClassFQN() {
41  		return this.baseClassFQN;
42  	}
43  
44  	public void setBaseClassFQN(String baseClassFQN) {
45  		this.baseClassFQN = baseClassFQN;
46  	}
47  
48  	@Override
49  	public boolean equals(Object o) {
50  		if (this == o) {
51  			return true;
52  		}
53  		if (o == null || getClass() != o.getClass()) {
54  			return false;
55  		}
56  		BaseClassMapping that = (BaseClassMapping) o;
57  		if (this.contractPackageRegex != null ? !this.contractPackageRegex.equals(that.contractPackageRegex)
58  				: that.contractPackageRegex != null) {
59  			return false;
60  		}
61  		return this.baseClassFQN != null ? this.baseClassFQN.equals(that.baseClassFQN) : that.baseClassFQN == null;
62  
63  	}
64  
65  	@Override
66  	public int hashCode() {
67  		int result = this.contractPackageRegex != null ? this.contractPackageRegex.hashCode() : 0;
68  		result = 31 * result + (this.baseClassFQN != null ? this.baseClassFQN.hashCode() : 0);
69  		return result;
70  	}
71  
72  	@Override
73  	public String toString() {
74  		return "BaseClassMapping{" + "contractPackageRegex='" + this.contractPackageRegex + '\'' + ", baseClassFQN='"
75  				+ this.baseClassFQN + '\'' + '}';
76  	}
77  
78  }