All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.rapidoid.inmem.RelPair Maven / Gradle / Ivy

package org.rapidoid.inmem;

/*
 * #%L
 * rapidoid-inmem
 * %%
 * Copyright (C) 2014 - 2015 Nikolche Mihajlovski
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import org.rapidoid.annotation.Authors;
import org.rapidoid.annotation.Since;
import org.rapidoid.beany.Prop;

@Authors("Nikolche Mihajlovski")
@Since("2.0.0")
public class RelPair {

	final String name;
	final Class src;
	final Class dest;
	final Prop srcProp;
	final Prop destProp;

	public RelPair(String name, Class src, Class dest, Prop srcProp, Prop destProp) {
		this.name = name;
		this.src = src;
		this.dest = dest;
		this.srcProp = srcProp;
		this.destProp = destProp;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((dest == null) ? 0 : dest.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((src == null) ? 0 : src.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		RelPair other = (RelPair) obj;
		if (dest == null) {
			if (other.dest != null)
				return false;
		} else if (!dest.equals(other.dest))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (src == null) {
			if (other.src != null)
				return false;
		} else if (!src.equals(other.src))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "RelPair [name=" + name + ", src=" + src.getSimpleName() + ", dest=" + dest.getSimpleName()
				+ ", srcProp=" + srcProp + ", destProp=" + destProp + "]";
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy