1
0
mirror of https://github.com/etesync/android synced 2024-12-24 23:48:35 +00:00

Delombokify: remove Setter/Getter usages.

This commit is contained in:
Tom Hacohen 2018-01-19 19:42:56 +00:00
parent 13c718977e
commit 1046164b83
12 changed files with 148 additions and 65 deletions

View File

@ -78,7 +78,6 @@ import io.requery.meta.EntityModel;
import io.requery.sql.Configuration; import io.requery.sql.Configuration;
import io.requery.sql.EntityDataStore; import io.requery.sql.EntityDataStore;
import lombok.Cleanup; import lombok.Cleanup;
import lombok.Getter;
import okhttp3.internal.tls.OkHostnameVerifier; import okhttp3.internal.tls.OkHostnameVerifier;
@AcraCore(buildConfigClass = BuildConfig.class) @AcraCore(buildConfigClass = BuildConfig.class)
@ -101,16 +100,12 @@ public class App extends Application {
public static final String DEFAULT_LANGUAGE = "default"; public static final String DEFAULT_LANGUAGE = "default";
public static Locale sDefaultLocacle = Locale.getDefault(); public static Locale sDefaultLocacle = Locale.getDefault();
@Getter
private static String appName; private static String appName;
@Getter
private CustomCertManager certManager; private CustomCertManager certManager;
@Getter
private static SSLSocketFactoryCompat sslSocketFactoryCompat; private static SSLSocketFactoryCompat sslSocketFactoryCompat;
@Getter
private static HostnameVerifier hostnameVerifier; private static HostnameVerifier hostnameVerifier;
public final static Logger log = Logger.getLogger("syncadapter"); public final static Logger log = Logger.getLogger("syncadapter");
@ -118,13 +113,38 @@ public class App extends Application {
at.bitfire.cert4android.Constants.log = Logger.getLogger("syncadapter.cert4android"); at.bitfire.cert4android.Constants.log = Logger.getLogger("syncadapter.cert4android");
} }
@Getter
private static String accountType; private static String accountType;
@Getter
private static String addressBookAccountType; private static String addressBookAccountType;
@Getter
private static String addressBooksAuthority; private static String addressBooksAuthority;
public static String getAppName() {
return App.appName;
}
public CustomCertManager getCertManager() {
return this.certManager;
}
public static SSLSocketFactoryCompat getSslSocketFactoryCompat() {
return App.sslSocketFactoryCompat;
}
public static HostnameVerifier getHostnameVerifier() {
return App.hostnameVerifier;
}
public static String getAccountType() {
return App.accountType;
}
public static String getAddressBookAccountType() {
return App.addressBookAccountType;
}
public static String getAddressBooksAuthority() {
return App.addressBooksAuthority;
}
@Override @Override
@SuppressLint("HardwareIds") @SuppressLint("HardwareIds")
public void onCreate() { public void onCreate() {

View File

@ -19,17 +19,19 @@ import java.util.logging.Level;
import at.bitfire.ical4android.CalendarStorageException; import at.bitfire.ical4android.CalendarStorageException;
import at.bitfire.vcard4android.ContactsStorageException; import at.bitfire.vcard4android.ContactsStorageException;
import lombok.Getter;
public class NotificationHelper { public class NotificationHelper {
final NotificationManagerCompat notificationManager; final NotificationManagerCompat notificationManager;
final Context context; final Context context;
final String notificationTag; final String notificationTag;
final int notificationId; final int notificationId;
@Getter
Intent detailsIntent; Intent detailsIntent;
int messageString; int messageString;
public Intent getDetailsIntent() {
return detailsIntent;
}
private Throwable throwable = null; private Throwable throwable = null;
public NotificationHelper(Context context, String notificationTag, int notificationId) { public NotificationHelper(Context context, String notificationTag, int notificationId) {

View File

@ -10,9 +10,6 @@ import java.io.IOException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.util.logging.Level; import java.util.logging.Level;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
@ -65,12 +62,21 @@ abstract class BaseManager {
} }
static class Base { static class Base {
@Setter(AccessLevel.PACKAGE)
@Getter(AccessLevel.PACKAGE)
private byte[] content; private byte[] content;
@Setter(AccessLevel.PACKAGE)
private String uid; private String uid;
void setContent(final byte[] content) {
this.content = content;
}
byte[] getContent() {
return this.content;
}
void setUid(final String uid) {
this.uid = uid;
}
public String getUid() { public String getUid() {
return uid; return uid;
} }

View File

@ -42,9 +42,6 @@ import java.security.SecureRandom;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale; import java.util.Locale;
import lombok.AccessLevel;
import lombok.Getter;
public class Crypto { public class Crypto {
public static String deriveKey(String salt, String password) { public static String deriveKey(String salt, String password) {
final int keySize = 190; final int keySize = 190;
@ -68,11 +65,17 @@ public class Crypto {
} }
public static class AsymmetricKeyPair implements Serializable { public static class AsymmetricKeyPair implements Serializable {
@Getter(AccessLevel.PUBLIC)
private final byte[] privateKey; private final byte[] privateKey;
@Getter(AccessLevel.PUBLIC)
private final byte[] publicKey; private final byte[] publicKey;
public byte[] getPrivateKey() {
return privateKey;
}
public byte[] getPublicKey() {
return publicKey;
}
public AsymmetricKeyPair(final byte[] privateKey, final byte[] publicKey) { public AsymmetricKeyPair(final byte[] privateKey, final byte[] publicKey) {
this.privateKey = privateKey; this.privateKey = privateKey;
this.publicKey = publicKey; this.publicKey = publicKey;
@ -146,12 +149,15 @@ public class Crypto {
final static int HMAC_SIZE = 256 / 8; // hmac256 in bytes final static int HMAC_SIZE = 256 / 8; // hmac256 in bytes
private SecureRandom _random = null; private SecureRandom _random = null;
@Getter
private final byte version; private final byte version;
private byte[] cipherKey; private byte[] cipherKey;
private byte[] hmacKey; private byte[] hmacKey;
private byte[] derivedKey; private byte[] derivedKey;
public byte getVersion() {
return version;
}
private void setDerivedKey(byte[] derivedKey) { private void setDerivedKey(byte[] derivedKey) {
cipherKey = hmac256("aes".getBytes(Charsets.UTF_8), derivedKey); cipherKey = hmac256("aes".getBytes(Charsets.UTF_8), derivedKey);
hmacKey = hmac256("hmac".getBytes(Charsets.UTF_8), derivedKey); hmacKey = hmac256("hmac".getBytes(Charsets.UTF_8), derivedKey);

View File

@ -1,14 +1,12 @@
package com.etesync.syncadapter.journalmanager; package com.etesync.syncadapter.journalmanager;
import com.etesync.syncadapter.App;
import com.etesync.syncadapter.GsonHelper;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.List; import java.util.List;
import com.etesync.syncadapter.App;
import com.etesync.syncadapter.GsonHelper;
import lombok.Getter;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Request; import okhttp3.Request;
@ -17,11 +15,13 @@ import okhttp3.Response;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
public class JournalEntryManager extends BaseManager { public class JournalEntryManager extends BaseManager {
@Getter
final String uid; final String uid;
final static private Type entryType = new TypeToken<List<Entry>>() { final static private Type entryType = new TypeToken<List<Entry>>() {
}.getType(); }.getType();
public String getUid() {
return uid;
}
public JournalEntryManager(OkHttpClient httpClient, HttpUrl remote, String journal) { public JournalEntryManager(OkHttpClient httpClient, HttpUrl remote, String journal) {
this.uid = journal; this.uid = journal;

View File

@ -6,12 +6,10 @@ import com.google.gson.reflect.TypeToken;
import org.spongycastle.util.Arrays; import org.spongycastle.util.Arrays;
import java.io.IOException;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import lombok.Getter;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Request; import okhttp3.Request;
@ -135,18 +133,27 @@ public class JournalManager extends BaseManager {
} }
public static class Journal extends Base { public static class Journal extends Base {
@Getter
private String owner; private String owner;
@Getter
private byte[] key; private byte[] key;
@Getter
private int version = -1; private int version = -1;
@Getter
private boolean readOnly = false; private boolean readOnly = false;
public String getOwner() {
return this.owner;
}
public byte[] getKey() {
return this.key;
}
public int getVersion() {
return this.version;
}
public boolean isReadOnly() {
return this.readOnly;
}
private transient byte[] hmac = null; private transient byte[] hmac = null;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@ -201,11 +208,17 @@ public class JournalManager extends BaseManager {
} }
public static class Member { public static class Member {
@Getter
private String user; private String user;
@Getter
private byte[] key; private byte[] key;
public String getUser() {
return user;
}
public byte[] getKey() {
return key;
}
@SuppressWarnings("unused") @SuppressWarnings("unused")
private Member() { private Member() {
} }

View File

@ -2,14 +2,11 @@ package com.etesync.syncadapter.journalmanager;
import com.etesync.syncadapter.GsonHelper; import com.etesync.syncadapter.GsonHelper;
import org.apache.commons.codec.Charsets;
import org.spongycastle.util.Arrays; import org.spongycastle.util.Arrays;
import java.io.IOException; import java.io.IOException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import lombok.Getter;
import lombok.Setter;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Request; import okhttp3.Request;
@ -89,15 +86,27 @@ public class UserInfoManager extends BaseManager {
} }
public static class UserInfo { public static class UserInfo {
@Setter
@Getter
private transient String owner; private transient String owner;
@Getter
private byte version; private byte version;
@Getter
private byte[] pubkey; private byte[] pubkey;
private byte[] content; private byte[] content;
public void setOwner(final String owner) {
this.owner = owner;
}
public String getOwner() {
return this.owner;
}
public byte getVersion() {
return this.version;
}
public byte[] getPubkey() {
return this.pubkey;
}
public byte[] getContent(Crypto.CryptoManager crypto) { public byte[] getContent(Crypto.CryptoManager crypto) {
byte[] content = Arrays.copyOfRange(this.content, HMAC_SIZE, this.content.length); byte[] content = Arrays.copyOfRange(this.content, HMAC_SIZE, this.content.length);
return crypto.decrypt(content); return crypto.decrypt(content);

View File

@ -6,14 +6,18 @@ import com.etesync.syncadapter.journalmanager.JournalEntryManager;
import java.io.Serializable; import java.io.Serializable;
import lombok.Getter;
public class SyncEntry implements Serializable { public class SyncEntry implements Serializable {
@Getter
private String content; private String content;
@Getter
private Actions action; private Actions action;
public String getContent() {
return content;
}
public Actions getAction() {
return action;
}
public enum Actions { public enum Actions {
ADD("ADD"), ADD("ADD"),
CHANGE("CHANGE"), CHANGE("CHANGE"),

View File

@ -37,8 +37,6 @@ import at.bitfire.ical4android.CalendarStorageException;
import at.bitfire.ical4android.Event; import at.bitfire.ical4android.Event;
import at.bitfire.vcard4android.ContactsStorageException; import at.bitfire.vcard4android.ContactsStorageException;
import lombok.Cleanup; import lombok.Cleanup;
import lombok.Getter;
import lombok.Setter;
@TargetApi(17) @TargetApi(17)
public class LocalEvent extends AndroidEvent implements LocalResource { public class LocalEvent extends AndroidEvent implements LocalResource {
@ -51,12 +49,21 @@ public class LocalEvent extends AndroidEvent implements LocalResource {
private boolean saveAsDirty = false; // When true, the resource will be saved as dirty private boolean saveAsDirty = false; // When true, the resource will be saved as dirty
@Getter private String fileName;
protected String fileName;
@Getter
@Setter
protected String eTag; protected String eTag;
private String getFileName() {
return fileName;
}
public String getETag() {
return eTag;
}
public void setETag(String eTag) {
this.eTag = eTag;
}
public boolean weAreOrganizer = true; public boolean weAreOrganizer = true;
public LocalEvent(@NonNull AndroidCalendar calendar, Event event, String fileName, String eTag) { public LocalEvent(@NonNull AndroidCalendar calendar, Event event, String fileName, String eTag) {

View File

@ -45,18 +45,20 @@ import at.bitfire.vcard4android.Contact;
import at.bitfire.vcard4android.ContactsStorageException; import at.bitfire.vcard4android.ContactsStorageException;
import ezvcard.VCardVersion; import ezvcard.VCardVersion;
import lombok.Cleanup; import lombok.Cleanup;
import lombok.Getter;
import lombok.ToString; import lombok.ToString;
import static at.bitfire.vcard4android.GroupMethod.GROUP_VCARDS; import static at.bitfire.vcard4android.GroupMethod.GROUP_VCARDS;
@ToString(callSuper=true) @ToString(callSuper=true)
public class LocalGroup extends AndroidGroup implements LocalResource { public class LocalGroup extends AndroidGroup implements LocalResource {
@Getter
protected String uuid; protected String uuid;
/** marshalled list of member UIDs, as sent by server */ /** marshalled list of member UIDs, as sent by server */
public static final String COLUMN_PENDING_MEMBERS = Groups.SYNC3; public static final String COLUMN_PENDING_MEMBERS = Groups.SYNC3;
public String getUuid() {
return uuid;
}
public LocalGroup(AndroidAddressBook addressBook, long id, String fileName, String eTag) { public LocalGroup(AndroidAddressBook addressBook, long id, String fileName, String eTag) {
super(addressBook, id, fileName, eTag); super(addressBook, id, fileName, eTag);
} }

View File

@ -14,7 +14,6 @@ import android.os.RemoteException;
import android.provider.CalendarContract.Events; import android.provider.CalendarContract.Events;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import com.etesync.syncadapter.App;
import com.etesync.syncadapter.Constants; import com.etesync.syncadapter.Constants;
import net.fortuna.ical4j.model.property.ProdId; import net.fortuna.ical4j.model.property.ProdId;
@ -32,23 +31,36 @@ import at.bitfire.ical4android.AndroidTaskList;
import at.bitfire.ical4android.CalendarStorageException; import at.bitfire.ical4android.CalendarStorageException;
import at.bitfire.ical4android.Task; import at.bitfire.ical4android.Task;
import at.bitfire.vcard4android.ContactsStorageException; import at.bitfire.vcard4android.ContactsStorageException;
import lombok.Getter;
import lombok.Setter;
public class LocalTask extends AndroidTask implements LocalResource { public class LocalTask extends AndroidTask implements LocalResource {
static { static {
Task.prodId = new ProdId(Constants.PRODID_BASE + " ical4j/2.x"); Task.prodId = new ProdId(Constants.PRODID_BASE + " ical4j/2.x");
} }
@Getter
protected String uuid; protected String uuid;
static final String COLUMN_ETAG = Tasks.SYNC1, static final String COLUMN_ETAG = Tasks.SYNC1,
COLUMN_UID = Tasks.SYNC2, COLUMN_UID = Tasks.SYNC2,
COLUMN_SEQUENCE = Tasks.SYNC3; COLUMN_SEQUENCE = Tasks.SYNC3;
@Getter protected String fileName; protected String fileName;
@Getter @Setter protected String eTag; protected String eTag;
public String getUuid() {
return uuid;
}
private String getFileName() {
return fileName;
}
public String getETag() {
return eTag;
}
public void setETag(String eTag) {
this.eTag = eTag;
}
public LocalTask(@NonNull AndroidTaskList taskList, Task task, String fileName, String eTag) { public LocalTask(@NonNull AndroidTaskList taskList, Task task, String fileName, String eTag) {
super(taskList, task); super(taskList, task);

View File

@ -25,7 +25,6 @@ import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import lombok.Getter;
import lombok.ToString; import lombok.ToString;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
@ -118,8 +117,11 @@ public class BaseConfigurationFinder {
public Throwable error; public Throwable error;
@Getter
private final boolean failed; private final boolean failed;
public boolean isFailed() {
return failed;
}
} }
} }