Skip to content

DATAREDIS-1143 - Delombok source files. #530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.3.0.BUILD-SNAPSHOT</version>
<version>2.3.0.DATAREDIS-1143-SNAPSHOT</version>

<name>Spring Data Redis</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
*/
package org.springframework.data.redis.connection;

import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.ExecutionException;
Expand Down Expand Up @@ -657,14 +652,16 @@ public int compare(PositionalKey o1, PositionalKey o2) {
* @author Christoph Strobl
* @since 2.0.3
*/
@Getter
@EqualsAndHashCode
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
private static class PositionalKey {

private final ByteArrayWrapper key;
private final int position;

private PositionalKey(ByteArrayWrapper key, int position) {
this.key = key;
this.position = position;
}

static PositionalKey of(byte[] key, int index) {
return new PositionalKey(new ByteArrayWrapper(key), index);
}
Expand All @@ -675,6 +672,35 @@ static PositionalKey of(byte[] key, int index) {
byte[] getBytes() {
return key.getArray();
}

public ByteArrayWrapper getKey() {
return this.key;
}

public int getPosition() {
return this.position;
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;

PositionalKey that = (PositionalKey) o;

if (position != that.position)
return false;
return ObjectUtils.nullSafeEquals(key, that.key);
}

@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(key);
result = 31 * result + position;
return result;
}
}

/**
Expand All @@ -684,11 +710,14 @@ byte[] getBytes() {
* @author Christoph Strobl
* @since 2.0.3
*/
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
private static class PositionalKeys implements Iterable<PositionalKey> {

private final List<PositionalKey> keys;

private PositionalKeys(List<PositionalKey> keys) {
this.keys = keys;
}

/**
* Create an empty {@link PositionalKeys}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@
*/
package org.springframework.data.redis.connection;

import lombok.EqualsAndHashCode;

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple;
import org.springframework.data.redis.connection.StringRedisConnection.StringTuple;
import org.springframework.util.ObjectUtils;

/**
* Default implementation for {@link StringTuple} interface.
*
* @author Costin Leau
*/
@EqualsAndHashCode(callSuper = true)
public class DefaultStringTuple extends DefaultTuple implements StringTuple {

private final String valueAsString;
Expand Down Expand Up @@ -60,4 +58,25 @@ public String getValueAsString() {
public String toString() {
return "DefaultStringTuple[value=" + getValueAsString() + ", score=" + getScore() + "]";
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
if (!super.equals(o))
return false;

DefaultStringTuple that = (DefaultStringTuple) o;

return ObjectUtils.nullSafeEquals(valueAsString, that.valueAsString);
}

@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + ObjectUtils.nullSafeHashCode(valueAsString);
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.springframework.data.redis.connection;

import lombok.Data;
import reactor.core.publisher.Mono;

import java.io.Closeable;
Expand All @@ -27,6 +26,7 @@
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;

/**
* Redis connection using reactive infrastructure declaring entry points for reactive command execution.
Expand Down Expand Up @@ -346,19 +346,58 @@ public Range<Long> getRange() {
* @param <I> command input type.
* @param <O> command output type.
*/
@Data
class CommandResponse<I, O> {

private final I input;
private final @Nullable O output;

public CommandResponse(I input, O output) {
this.input = input;
this.output = output;
}

/**
* @return {@literal true} if the response is present. An absent {@link CommandResponse} maps to Redis
* {@literal (nil)}.
*/
public boolean isPresent() {
return true;
}

public I getInput() {
return this.input;
}

@Nullable
public O getOutput() {
return this.output;
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;

CommandResponse<?, ?> that = (CommandResponse<?, ?>) o;

if (!ObjectUtils.nullSafeEquals(input, that.input)) {
return false;
}
return ObjectUtils.nullSafeEquals(output, that.output);
}

@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(input);
result = 31 * result + ObjectUtils.nullSafeHashCode(output);
return result;
}

public String toString() {
return "ReactiveRedisConnection.CommandResponse(input=" + this.getInput() + ", output=" + this.getOutput() + ")";
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/
package org.springframework.data.redis.connection;

import lombok.EqualsAndHashCode;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.nio.ByteBuffer;
import java.util.Set;

import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;

/**
* Subscription for Redis channels using reactive infrastructure. A {@link ReactiveSubscription} allows subscribing to
Expand Down Expand Up @@ -155,7 +155,6 @@ interface Message<C, M> {
* @author Christoph Strobl
* @since 2.1
*/
@EqualsAndHashCode
class ChannelMessage<C, M> implements Message<C, M> {

private final C channel;
Expand Down Expand Up @@ -194,6 +193,28 @@ public M getMessage() {
return message;
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;

ChannelMessage<?, ?> that = (ChannelMessage<?, ?>) o;

if (!ObjectUtils.nullSafeEquals(channel, that.channel)) {
return false;
}
return ObjectUtils.nullSafeEquals(message, that.message);
}

@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(channel);
result = 31 * result + ObjectUtils.nullSafeHashCode(message);
return result;
}

@Override
public String toString() {
return "ChannelMessage {" + "channel=" + channel + ", message=" + message + '}';
Expand All @@ -210,7 +231,6 @@ public String toString() {
* @author Christoph Strobl
* @since 2.1
*/
@EqualsAndHashCode(callSuper = true)
class PatternMessage<P, C, M> extends ChannelMessage<C, M> {

private final P pattern;
Expand Down Expand Up @@ -239,6 +259,27 @@ public P getPattern() {
return pattern;
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
if (!super.equals(o))
return false;

PatternMessage<?, ?, ?> that = (PatternMessage<?, ?, ?>) o;

return ObjectUtils.nullSafeEquals(pattern, that.pattern);
}

@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + ObjectUtils.nullSafeHashCode(pattern);
return result;
}

@Override
public String toString() {
return "PatternMessage{" + "channel=" + getChannel() + ", pattern=" + pattern + ", message=" + getMessage() + '}';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package org.springframework.data.redis.connection;

import lombok.Data;
import lombok.RequiredArgsConstructor;

import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -355,12 +352,60 @@ protected GeoRadiusCommandArgs clone() {
* @param <T>
* @since 1.8
*/
@Data
@RequiredArgsConstructor
class GeoLocation<T> {

private final T name;
private final Point point;

public GeoLocation(T name, Point point) {
this.name = name;
this.point = point;
}

public T getName() {
return this.name;
}

public Point getPoint() {
return this.point;
}

public boolean equals(final Object o) {
if (o == this)
return true;
if (!(o instanceof GeoLocation))
return false;
final GeoLocation<?> other = (GeoLocation<?>) o;
if (!other.canEqual((Object) this))
return false;
final Object this$name = this.getName();
final Object other$name = other.getName();
if (this$name == null ? other$name != null : !this$name.equals(other$name))
return false;
final Object this$point = this.getPoint();
final Object other$point = other.getPoint();
if (this$point == null ? other$point != null : !this$point.equals(other$point))
return false;
return true;
}

protected boolean canEqual(final Object other) {
return other instanceof GeoLocation;
}

public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $name = this.getName();
result = result * PRIME + ($name == null ? 43 : $name.hashCode());
final Object $point = this.getPoint();
result = result * PRIME + ($point == null ? 43 : $point.hashCode());
return result;
}

public String toString() {
return "RedisGeoCommands.GeoLocation(name=" + this.getName() + ", point=" + this.getPoint() + ")";
}
}

/**
Expand Down
Loading