Skip to content

Commit f1ffd12

Browse files
committed
refactor: removed lombok from the project and added necessary methods to the classes. Fixes fossasia#2371
1 parent a83c742 commit f1ffd12

40 files changed

+3584
-177
lines changed

android/app/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ dependencies {
107107
implementation 'com.github.yalantis:ucrop:2.2.1'
108108
implementation 'io.reactivex.rxjava2:rxjava:2.1.3'
109109
implementation "android.arch.lifecycle:reactivestreams:1.0.0"
110-
compileOnly "org.projectlombok:lombok:1.16.18"
111-
annotationProcessor "org.projectlombok:lombok:1.16.18"
112110
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
113111

114112
// Googleplay Variant
Lines changed: 107 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,122 @@
11
package org.fossasia.openevent.config;
22

3-
import lombok.Builder;
4-
import lombok.Data;
5-
63
/**
74
* Config to be replaced in {@link org.fossasia.openevent.config.strategies.AppConfigStrategy}
85
*
96
* TODO: Add the correct JSON parsing mechanism and populate config in this format and share across project
107
*
118
* NOT IMPLEMENTED YET
129
*/
13-
@Data
14-
@Builder
1510
public class Config {
1611
private final String apiLink;
1712
private final String email;
1813
private final String appName;
1914
private final boolean authEnabled;
15+
16+
Config(String apiLink, String email, String appName, boolean authEnabled) {
17+
this.apiLink = apiLink;
18+
this.email = email;
19+
this.appName = appName;
20+
this.authEnabled = authEnabled;
21+
}
22+
23+
public static ConfigBuilder builder() {
24+
return new ConfigBuilder();
25+
}
26+
27+
public String getApiLink() {
28+
return this.apiLink;
29+
}
30+
31+
public String getEmail() {
32+
return this.email;
33+
}
34+
35+
public String getAppName() {
36+
return this.appName;
37+
}
38+
39+
public boolean getAuthEnabled() {
40+
return this.authEnabled;
41+
}
42+
43+
public boolean equals(Object o) {
44+
if (o == this) return true;
45+
if (!(o instanceof Config)) return false;
46+
final Config other = (Config) o;
47+
if (!other.canEqual((Object) this)) return false;
48+
final Object this$apiLink = this.getApiLink();
49+
final Object other$apiLink = other.getApiLink();
50+
if (this$apiLink == null ? other$apiLink != null : !this$apiLink.equals(other$apiLink))
51+
return false;
52+
final Object this$email = this.getEmail();
53+
final Object other$email = other.getEmail();
54+
if (this$email == null ? other$email != null : !this$email.equals(other$email))
55+
return false;
56+
final Object this$appName = this.getAppName();
57+
final Object other$appName = other.getAppName();
58+
if (this$appName == null ? other$appName != null : !this$appName.equals(other$appName))
59+
return false;
60+
if (this.getAuthEnabled() != other.getAuthEnabled()) return false;
61+
return true;
62+
}
63+
64+
public int hashCode() {
65+
final int PRIME = 59;
66+
int result = 1;
67+
final Object $apiLink = this.getApiLink();
68+
result = result * PRIME + ($apiLink == null ? 43 : $apiLink.hashCode());
69+
final Object $email = this.getEmail();
70+
result = result * PRIME + ($email == null ? 43 : $email.hashCode());
71+
final Object $appName = this.getAppName();
72+
result = result * PRIME + ($appName == null ? 43 : $appName.hashCode());
73+
result = result * PRIME + (this.getAuthEnabled() ? 79 : 97);
74+
return result;
75+
}
76+
77+
protected boolean canEqual(Object other) {
78+
return other instanceof Config;
79+
}
80+
81+
public String toString() {
82+
return "Config(apiLink=" + this.getApiLink() + ", email=" + this.getEmail() + ", appName=" + this.getAppName() + ", authEnabled=" + this.getAuthEnabled() + ")";
83+
}
84+
85+
public static class ConfigBuilder {
86+
private String apiLink;
87+
private String email;
88+
private String appName;
89+
private boolean authEnabled;
90+
91+
ConfigBuilder() {
92+
}
93+
94+
public Config.ConfigBuilder apiLink(String apiLink) {
95+
this.apiLink = apiLink;
96+
return this;
97+
}
98+
99+
public Config.ConfigBuilder email(String email) {
100+
this.email = email;
101+
return this;
102+
}
103+
104+
public Config.ConfigBuilder appName(String appName) {
105+
this.appName = appName;
106+
return this;
107+
}
108+
109+
public Config.ConfigBuilder authEnabled(boolean authEnabled) {
110+
this.authEnabled = authEnabled;
111+
return this;
112+
}
113+
114+
public Config build() {
115+
return new Config(apiLink, email, appName, authEnabled);
116+
}
117+
118+
public String toString() {
119+
return "Config.ConfigBuilder(apiLink=" + this.apiLink + ", email=" + this.email + ", appName=" + this.appName + ", authEnabled=" + this.authEnabled + ")";
120+
}
121+
}
20122
}

android/app/src/main/java/org/fossasia/openevent/config/ConfigStrategyHolder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
import java.util.LinkedHashSet;
44
import java.util.Set;
55

6-
import lombok.Getter;
7-
8-
@Getter
96
public class ConfigStrategyHolder {
107

118
private final Set<ConfigStrategy> strategies = new LinkedHashSet<>();
@@ -14,4 +11,7 @@ public void register(ConfigStrategy configStrategy) {
1411
strategies.add(configStrategy);
1512
}
1613

14+
public Set<ConfigStrategy> getStrategies() {
15+
return this.strategies;
16+
}
1717
}

android/app/src/main/java/org/fossasia/openevent/config/StrategyRegistry.java

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@
1010
import org.fossasia.openevent.config.strategies.TimberStrategy;
1111
import org.fossasia.openevent.config.strategies.TimeConfigStrategy;
1212

13-
import lombok.Setter;
14-
1513
/**
1614
* Project level configuration strategies holder singleton
1715
*
1816
* Holds all strategies and provides an interface to get singleton strategies or
1917
* override the default strategy holder. Also sets the order and strategies in default
2018
* holder which is then utilised by {@link AppConfigurer} to configure the application
2119
*/
22-
@Setter
2320
public class StrategyRegistry {
2421

2522
private static StrategyRegistry strategyRegistry;
@@ -99,4 +96,31 @@ public ConfigStrategyHolder getDefaultHolder() {
9996
return defaultHolder;
10097
}
10198

99+
public void setStrategyHolder(ConfigStrategyHolder strategyHolder) {
100+
this.strategyHolder = strategyHolder;
101+
}
102+
103+
public void setHttpStrategy(HttpStrategy httpStrategy) {
104+
this.httpStrategy = httpStrategy;
105+
}
106+
107+
public void setLanguageStrategy(LanguageStrategy languageStrategy) {
108+
this.languageStrategy = languageStrategy;
109+
}
110+
111+
public void setLeakCanaryStrategy(LeakCanaryStrategy leakCanaryStrategy) {
112+
this.leakCanaryStrategy = leakCanaryStrategy;
113+
}
114+
115+
public void setEventBusStrategy(EventBusStrategy eventBusStrategy) {
116+
this.eventBusStrategy = eventBusStrategy;
117+
}
118+
119+
public void setMapModuleStrategy(MapModuleStrategy mapModuleStrategy) {
120+
this.mapModuleStrategy = mapModuleStrategy;
121+
}
122+
123+
public void setAppConfigStrategy(AppConfigStrategy appConfigStrategy) {
124+
this.appConfigStrategy = appConfigStrategy;
125+
}
102126
}

android/app/src/main/java/org/fossasia/openevent/config/strategies/HttpStrategy.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
import java.io.File;
1515

16-
import lombok.Getter;
1716
import okhttp3.Cache;
1817
import okhttp3.OkHttpClient;
1918

@@ -23,7 +22,6 @@
2322
* Also provides an interface for application to use Picasso with cache
2423
* To be used via {@link org.fossasia.openevent.config.StrategyRegistry}
2524
*/
26-
@Getter
2725
public class HttpStrategy implements ConfigStrategy {
2826

2927
private Picasso picassoWithCache;
@@ -59,4 +57,7 @@ public boolean configure(Context context) {
5957
return false;
6058
}
6159

60+
public Picasso getPicassoWithCache() {
61+
return this.picassoWithCache;
62+
}
6263
}

android/app/src/main/java/org/fossasia/openevent/config/strategies/LanguageStrategy.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@
66

77
import java.util.Locale;
88

9-
import lombok.Getter;
10-
import lombok.Setter;
11-
129
/**
1310
* Sets and provides default system language
1411
* To be used via {@link org.fossasia.openevent.config.StrategyRegistry}
1512
*/
16-
@Setter
17-
@Getter
1813
public class LanguageStrategy implements ConfigStrategy {
1914

2015
private String defaultSystemLanguage;
@@ -25,4 +20,11 @@ public boolean configure(Context context) {
2520
return false;
2621
}
2722

23+
public String getDefaultSystemLanguage() {
24+
return this.defaultSystemLanguage;
25+
}
26+
27+
public void setDefaultSystemLanguage(String defaultSystemLanguage) {
28+
this.defaultSystemLanguage = defaultSystemLanguage;
29+
}
2830
}

android/app/src/main/java/org/fossasia/openevent/config/strategies/LeakCanaryStrategy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@
88
import org.fossasia.openevent.OpenEventApp;
99
import org.fossasia.openevent.config.ConfigStrategy;
1010

11-
import lombok.Getter;
12-
1311
/**
1412
* Configures and provides Leak Canary Reference Watcher
1513
* To be used via {@link org.fossasia.openevent.config.StrategyRegistry}
1614
*/
17-
@Getter
1815
public class LeakCanaryStrategy implements ConfigStrategy {
1916

2017
private RefWatcher refWatcher;
@@ -31,4 +28,7 @@ public boolean configure(Context context) {
3128
return false;
3229
}
3330

31+
public RefWatcher getRefWatcher() {
32+
return this.refWatcher;
33+
}
3434
}

android/app/src/main/java/org/fossasia/openevent/config/strategies/MapModuleStrategy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55
import org.fossasia.openevent.config.ConfigStrategy;
66
import org.fossasia.openevent.core.location.modules.MapModuleFactory;
77

8-
import lombok.Getter;
9-
108
/**
119
* Configures and provides Map Module Factory to switch map implementations between flavours
1210
* To be used via {@link org.fossasia.openevent.config.StrategyRegistry}
1311
*/
14-
@Getter
1512
public class MapModuleStrategy implements ConfigStrategy {
1613

1714
private MapModuleFactory mapModuleFactory;
@@ -22,4 +19,7 @@ public boolean configure(Context context) {
2219
return false;
2320
}
2421

22+
public MapModuleFactory getMapModuleFactory() {
23+
return this.mapModuleFactory;
24+
}
2525
}

android/app/src/main/java/org/fossasia/openevent/core/auth/LoginActivityViewModel.java

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import io.reactivex.android.schedulers.AndroidSchedulers;
1111
import io.reactivex.disposables.CompositeDisposable;
1212
import io.reactivex.schedulers.Schedulers;
13-
import lombok.Data;
1413
import timber.log.Timber;
1514

1615
import static org.fossasia.openevent.core.auth.AuthUtil.INVALID;
@@ -44,9 +43,51 @@ protected void onCleared() {
4443
super.onCleared();
4544
}
4645

47-
@Data
4846
public static class LoginResponse {
4947
private final int response;
5048
private final String accessToken;
49+
50+
public LoginResponse(int response, String accessToken) {
51+
this.response = response;
52+
this.accessToken = accessToken;
53+
}
54+
55+
public int getResponse() {
56+
return this.response;
57+
}
58+
59+
public String getAccessToken() {
60+
return this.accessToken;
61+
}
62+
63+
public boolean equals(Object o) {
64+
if (o == this) return true;
65+
if (!(o instanceof LoginResponse)) return false;
66+
final LoginResponse other = (LoginResponse) o;
67+
if (!other.canEqual((Object) this)) return false;
68+
if (this.getResponse() != other.getResponse()) return false;
69+
final Object this$accessToken = this.getAccessToken();
70+
final Object other$accessToken = other.getAccessToken();
71+
if (this$accessToken == null ? other$accessToken != null : !this$accessToken.equals(other$accessToken))
72+
return false;
73+
return true;
74+
}
75+
76+
public int hashCode() {
77+
final int PRIME = 59;
78+
int result = 1;
79+
result = result * PRIME + this.getResponse();
80+
final Object $accessToken = this.getAccessToken();
81+
result = result * PRIME + ($accessToken == null ? 43 : $accessToken.hashCode());
82+
return result;
83+
}
84+
85+
protected boolean canEqual(Object other) {
86+
return other instanceof LoginResponse;
87+
}
88+
89+
public String toString() {
90+
return "LoginActivityViewModel.LoginResponse(response=" + this.getResponse() + ", accessToken=" + this.getAccessToken() + ")";
91+
}
5192
}
5293
}

0 commit comments

Comments
 (0)