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

com.redis.spring.batch.reader.Wrapper Maven / Gradle / Ivy

package com.redis.spring.batch.reader;

import java.util.Arrays;

public class Wrapper {

	private final T value;

	public Wrapper(T key) {
		this.value = key;
	}

	public T getValue() {
		return value;
	}

	@Override
	public int hashCode() {
		if (value instanceof byte[]) {
			return Arrays.hashCode((byte[]) value);
		}
		return value.hashCode();
	}

	@SuppressWarnings("unchecked")
	@Override
	public boolean equals(Object obj) {

		if (!(obj instanceof Wrapper)) {
			return false;
		}

		Wrapper that = (Wrapper) obj;

		if (value instanceof byte[] && that.value instanceof byte[]) {
			return Arrays.equals((byte[]) value, (byte[]) that.value);
		}

		return value.equals(that.value);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy