1
0
mirror of https://github.com/etesync/android synced 2024-12-23 23:18:46 +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.EntityDataStore;
import lombok.Cleanup;
import lombok.Getter;
import okhttp3.internal.tls.OkHostnameVerifier;
@AcraCore(buildConfigClass = BuildConfig.class)
@ -101,16 +100,12 @@ public class App extends Application {
public static final String DEFAULT_LANGUAGE = "default";
public static Locale sDefaultLocacle = Locale.getDefault();
@Getter
private static String appName;
@Getter
private CustomCertManager certManager;
@Getter
private static SSLSocketFactoryCompat sslSocketFactoryCompat;
@Getter
private static HostnameVerifier hostnameVerifier;
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");
}
@Getter
private static String accountType;
@Getter
private static String addressBookAccountType;
@Getter
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
@SuppressLint("HardwareIds")
public void onCreate() {

View File

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

View File

@ -10,9 +10,6 @@ import java.io.IOException;
import java.net.HttpURLConnection;
import java.util.logging.Level;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
@ -65,12 +62,21 @@ abstract class BaseManager {
}
static class Base {
@Setter(AccessLevel.PACKAGE)
@Getter(AccessLevel.PACKAGE)
private byte[] content;
@Setter(AccessLevel.PACKAGE)
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() {
return uid;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,8 +37,6 @@ import at.bitfire.ical4android.CalendarStorageException;
import at.bitfire.ical4android.Event;
import at.bitfire.vcard4android.ContactsStorageException;
import lombok.Cleanup;
import lombok.Getter;
import lombok.Setter;
@TargetApi(17)
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
@Getter
protected String fileName;
@Getter
@Setter
private String fileName;
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 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 ezvcard.VCardVersion;
import lombok.Cleanup;
import lombok.Getter;
import lombok.ToString;
import static at.bitfire.vcard4android.GroupMethod.GROUP_VCARDS;
@ToString(callSuper=true)
public class LocalGroup extends AndroidGroup implements LocalResource {
@Getter
protected String uuid;
/** marshalled list of member UIDs, as sent by server */
public static final String COLUMN_PENDING_MEMBERS = Groups.SYNC3;
public String getUuid() {
return uuid;
}
public LocalGroup(AndroidAddressBook addressBook, long id, String fileName, String eTag) {
super(addressBook, id, fileName, eTag);
}

View File

@ -14,7 +14,6 @@ import android.os.RemoteException;
import android.provider.CalendarContract.Events;
import android.support.annotation.NonNull;
import com.etesync.syncadapter.App;
import com.etesync.syncadapter.Constants;
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.Task;
import at.bitfire.vcard4android.ContactsStorageException;
import lombok.Getter;
import lombok.Setter;
public class LocalTask extends AndroidTask implements LocalResource {
static {
Task.prodId = new ProdId(Constants.PRODID_BASE + " ical4j/2.x");
}
@Getter
protected String uuid;
static final String COLUMN_ETAG = Tasks.SYNC1,
COLUMN_UID = Tasks.SYNC2,
COLUMN_SEQUENCE = Tasks.SYNC3;
@Getter protected String fileName;
@Getter @Setter protected String eTag;
protected String fileName;
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) {
super(taskList, task);

View File

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