Skip to content

Commit

Permalink
Remove duplicated lombok annotations in the pulsar-functions modules (a…
Browse files Browse the repository at this point in the history
…pache#6063)

### Motivation

Some of the classes in the pulsar-functions module had a mixture of the following lombok annotations:

```
@DaTa
@Setter	
@Getter	
@EqualsAndHashCode	
@tostring
```

The [@DaTa](https://projectlombok.org/features/Data) annotation includes all other annotations:

> All together now: A shortcut for @tostring, @EqualsAndHashCode, @Getter on all fields, @Setter on all non-final fields, and @requiredargsconstructor!


### Modifications

Removed `@Setter`, `@Getter`, `@EqualsAndHashCode`, and '@tostring' if the `@Data` annotation was also present
  • Loading branch information
vzhikserg authored and sijie committed Jan 21, 2020
1 parent e4099a2 commit f8a7386
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.testng.annotations.Test;

/**
Expand All @@ -34,8 +32,6 @@ public class JavaSerDeTest {

@Data
@AllArgsConstructor
@EqualsAndHashCode
@ToString
private static class TestObject implements Serializable {

private int intField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,11 @@

import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
* Configuration to aggregate various authentication params.
*/
@Data
@Getter
@Setter
@EqualsAndHashCode
@ToString
@Builder
public class AuthenticationConfig {
private String clientAuthenticationPlugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
package org.apache.pulsar.functions.instance;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.pulsar.functions.proto.Function;
import org.apache.pulsar.functions.proto.Function.FunctionDetails;

Expand All @@ -31,10 +27,6 @@
* passed to run functions.
*/
@Data
@Getter
@Setter
@EqualsAndHashCode
@ToString
public class InstanceConfig {
private int instanceId;
private String functionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,14 @@
*/
package org.apache.pulsar.functions.instance;

import lombok.*;
import lombok.Data;

/**
* This is the Java Instance. This is started by the runtimeSpawner using the JavaInstanceClient
* program if invoking via a process based invocation or using JavaInstance using a thread
* based invocation.
*/
@Data
@Setter
@Getter
@EqualsAndHashCode
@ToString
public class JavaExecutionResult {
private Exception userException;
private Exception systemException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@
package org.apache.pulsar.functions.api.examples.pojo;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
* Pojo to represent a stock tick.
*/
@Data
@ToString
@EqualsAndHashCode
public class Tick {

private long timeStamp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@
package org.apache.pulsar.functions.runtime.kubernetes;

import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.apache.pulsar.common.configuration.FieldContext;

import java.util.Map;

@Data
@ToString
@Accessors(chain = true)
public class KubernetesRuntimeFactoryConfig {
@FieldContext(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
package org.apache.pulsar.functions.runtime.process;

import lombok.Data;
import lombok.ToString;
import org.apache.pulsar.common.configuration.FieldContext;

@Data
@ToString
public class ProcessRuntimeFactoryConfig {
@FieldContext(
doc = "The path to the java instance. Change the jar location only when you put"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
package org.apache.pulsar.functions.runtime.thread;

import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.apache.pulsar.common.configuration.FieldContext;

@Data
@ToString
@Accessors(chain = true)
public class ThreadRuntimeFactoryConfig {
@FieldContext(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,13 @@
import org.apache.pulsar.common.functions.Resources;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.apache.pulsar.functions.runtime.kubernetes.KubernetesRuntimeFactoryConfig;
import org.apache.pulsar.functions.runtime.process.ProcessRuntimeFactoryConfig;
import org.apache.pulsar.functions.runtime.thread.ThreadRuntimeFactory;
import org.apache.pulsar.functions.runtime.thread.ThreadRuntimeFactoryConfig;

@Data
@Setter
@Getter
@EqualsAndHashCode
@ToString
@Accessors(chain = true)
@JsonIgnoreProperties(ignoreUnknown = true)
public class WorkerConfig implements Serializable, PulsarConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
import com.google.common.io.RecursiveDeleteOption;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.distributedlog.api.namespace.Namespace;
Expand Down Expand Up @@ -74,10 +70,6 @@
import static org.apache.pulsar.functions.utils.FunctionCommon.getSourceType;

@Data
@Setter
@Getter
@EqualsAndHashCode
@ToString
@Slf4j
public class FunctionActioner {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@
*/
package org.apache.pulsar.functions.worker;

import lombok.*;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.pulsar.functions.proto.Function.Instance;
import org.apache.pulsar.functions.runtime.RuntimeSpawner;

@Data
@Setter
@Getter
@Accessors(chain = true)
public class FunctionRuntimeInfo {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
package org.apache.pulsar.functions.worker.request;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.apache.pulsar.client.api.MessageId;

Expand All @@ -31,9 +28,6 @@
import org.apache.pulsar.functions.proto.Request.ServiceRequest;

@Data
@Getter
@EqualsAndHashCode
@ToString
@Accessors(chain = true)
public class ServiceRequestInfo {
private final ServiceRequest serviceRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
public class MockExecutorController {

@Data
@Getter
private class DeferredTask implements ScheduledFuture<Void> {

private final Runnable runnable;
Expand Down

0 comments on commit f8a7386

Please sign in to comment.