From 2b1634031da503184ec7ea4e8ac8fe57612ac93f Mon Sep 17 00:00:00 2001 From: Teodor G Date: Tue, 13 Apr 2021 11:02:21 +0300 Subject: [PATCH 1/3] rename from `memo-annotation` --- demo/proguard-rules.pro | 2 +- .../{MemoChangedListener.java => IMemoChangedListener.java} | 4 ++-- .../{MemoStorageImpl.java => IMemoStorageImpl.java} | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename memo-annotation/src/main/java/com/zeoflow/memo/annotation/{MemoChangedListener.java => IMemoChangedListener.java} (87%) rename memo-annotation/src/main/java/com/zeoflow/memo/annotation/{MemoStorageImpl.java => IMemoStorageImpl.java} (94%) diff --git a/demo/proguard-rules.pro b/demo/proguard-rules.pro index c8892a6..9b8d0e5 100644 --- a/demo/proguard-rules.pro +++ b/demo/proguard-rules.pro @@ -20,4 +20,4 @@ # hide the original source file value. #-renamesourcefileattribute SourceFile --keep public class * implements com.zeoflow.memo.annotation.MemoStorageImpl { *; } \ No newline at end of file +-keep public class * implements com.zeoflow.memo.annotation.IMemoStorageImpl { *; } \ No newline at end of file diff --git a/memo-annotation/src/main/java/com/zeoflow/memo/annotation/MemoChangedListener.java b/memo-annotation/src/main/java/com/zeoflow/memo/annotation/IMemoChangedListener.java similarity index 87% rename from memo-annotation/src/main/java/com/zeoflow/memo/annotation/MemoChangedListener.java rename to memo-annotation/src/main/java/com/zeoflow/memo/annotation/IMemoChangedListener.java index 2ce71d0..486bc67 100644 --- a/memo-annotation/src/main/java/com/zeoflow/memo/annotation/MemoChangedListener.java +++ b/memo-annotation/src/main/java/com/zeoflow/memo/annotation/IMemoChangedListener.java @@ -17,11 +17,11 @@ package com.zeoflow.memo.annotation; /** - * MemoChangedListener is an interface of the listening for + * IMemoChangedListener is an interface of the listening for * *

SharedPreference persistence's value changes. */ -public interface MemoChangedListener +public interface IMemoChangedListener { } diff --git a/memo-annotation/src/main/java/com/zeoflow/memo/annotation/MemoStorageImpl.java b/memo-annotation/src/main/java/com/zeoflow/memo/annotation/IMemoStorageImpl.java similarity index 94% rename from memo-annotation/src/main/java/com/zeoflow/memo/annotation/MemoStorageImpl.java rename to memo-annotation/src/main/java/com/zeoflow/memo/annotation/IMemoStorageImpl.java index 34948ee..df99135 100644 --- a/memo-annotation/src/main/java/com/zeoflow/memo/annotation/MemoStorageImpl.java +++ b/memo-annotation/src/main/java/com/zeoflow/memo/annotation/IMemoStorageImpl.java @@ -16,7 +16,7 @@ package com.zeoflow.memo.annotation; -public interface MemoStorageImpl +public interface IMemoStorageImpl { } From 6a24942f4e511a939c9faaf4897d5a6c16e3a018 Mon Sep 17 00:00:00 2001 From: Teodor G Date: Tue, 13 Apr 2021 11:02:41 +0300 Subject: [PATCH 2/3] rename from `memo-compiler` --- .../java/com/zeoflow/memo/processor/InjectorGenerator.java | 6 +++--- .../memo/processor/PreferenceChangeListenerGenerator.java | 4 ++-- .../memo/processor/PreferenceComponentGenerator.java | 2 +- .../zeoflow/memo/processor/PreferenceEntityGenerator.java | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/memo-compiler/src/main/java/com/zeoflow/memo/processor/InjectorGenerator.java b/memo-compiler/src/main/java/com/zeoflow/memo/processor/InjectorGenerator.java index 3bb32cc..942c71a 100644 --- a/memo-compiler/src/main/java/com/zeoflow/memo/processor/InjectorGenerator.java +++ b/memo-compiler/src/main/java/com/zeoflow/memo/processor/InjectorGenerator.java @@ -26,7 +26,7 @@ import com.zeoflow.jx.file.TypeSpec; import com.zeoflow.memo.annotation.Encoder; import com.zeoflow.memo.annotation.InjectPreference; -import com.zeoflow.memo.annotation.MemoStorageImpl; +import com.zeoflow.memo.annotation.IMemoStorageImpl; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; @@ -64,9 +64,9 @@ public TypeSpec generate() { return TypeSpec.classBuilder(getClazzName()) .addJavadoc("Injector Class for $T\n", TypeName.get(injectedElement.asType())) - .addJavadoc("Generated by Storage (https://github.com/zeoflow/storage).\n") + .addJavadoc("Generated by IStorage (https://github.com/zeoflow/storage).\n") .addModifiers(PUBLIC) - .addSuperinterface(MemoStorageImpl.class) + .addSuperinterface(IMemoStorageImpl.class) .superclass(TypeName.get(injectedElement.asType())) .addMethod(getConstructorSpec()) .build(); diff --git a/memo-compiler/src/main/java/com/zeoflow/memo/processor/PreferenceChangeListenerGenerator.java b/memo-compiler/src/main/java/com/zeoflow/memo/processor/PreferenceChangeListenerGenerator.java index a7be89d..e157752 100644 --- a/memo-compiler/src/main/java/com/zeoflow/memo/processor/PreferenceChangeListenerGenerator.java +++ b/memo-compiler/src/main/java/com/zeoflow/memo/processor/PreferenceChangeListenerGenerator.java @@ -24,7 +24,7 @@ import com.zeoflow.jx.file.ParameterSpec; import com.zeoflow.jx.file.ParameterizedTypeName; import com.zeoflow.jx.file.TypeSpec; -import com.zeoflow.memo.annotation.MemoChangedListener; +import com.zeoflow.memo.annotation.IMemoChangedListener; import java.util.List; @@ -54,7 +54,7 @@ public TypeSpec generateInterface() TypeSpec.Builder builder = TypeSpec.interfaceBuilder(getClazzName()) .addModifiers(PUBLIC) - .addSuperinterface(MemoChangedListener.class) + .addSuperinterface(IMemoChangedListener.class) .addMethod(getOnChangedSpec()); return builder.build(); } diff --git a/memo-compiler/src/main/java/com/zeoflow/memo/processor/PreferenceComponentGenerator.java b/memo-compiler/src/main/java/com/zeoflow/memo/processor/PreferenceComponentGenerator.java index 224dacb..c29fc4e 100644 --- a/memo-compiler/src/main/java/com/zeoflow/memo/processor/PreferenceComponentGenerator.java +++ b/memo-compiler/src/main/java/com/zeoflow/memo/processor/PreferenceComponentGenerator.java @@ -66,7 +66,7 @@ public PreferenceComponentGenerator( public TypeSpec generate() { return TypeSpec.classBuilder(getClazzName()) - .addJavadoc("Generated by Storage (https://github.com/zeoflow/storage).\n") + .addJavadoc("Generated by IStorage (https://github.com/zeoflow/storage).\n") .addModifiers(PUBLIC) .addSuperinterface(annotatedClazz.typeName) .addField(getInstanceFieldSpec()) diff --git a/memo-compiler/src/main/java/com/zeoflow/memo/processor/PreferenceEntityGenerator.java b/memo-compiler/src/main/java/com/zeoflow/memo/processor/PreferenceEntityGenerator.java index 749bb08..7928b89 100644 --- a/memo-compiler/src/main/java/com/zeoflow/memo/processor/PreferenceEntityGenerator.java +++ b/memo-compiler/src/main/java/com/zeoflow/memo/processor/PreferenceEntityGenerator.java @@ -72,7 +72,7 @@ public TypeSpec generate() TypeSpec.Builder builder = TypeSpec.classBuilder(getClazzName()) .addJavadoc("Preference class for $T\n", ClassName.get(annotatedClazz.annotatedElement)) - .addJavadoc("Generated by Storage (https://github.com/zeoflow/storage).\n") + .addJavadoc("Generated by IStorage (https://github.com/zeoflow/storage).\n") .addModifiers(PUBLIC) .superclass(ClassName.get(annotatedClazz.annotatedElement)) .addFields(getFieldSpecs()); From d3bf6129a8e5c3ed9b8e8aff360f33a7bb5a98f6 Mon Sep 17 00:00:00 2001 From: Teodor G Date: Tue, 13 Apr 2021 11:02:57 +0300 Subject: [PATCH 3/3] rename inside `memo` module --- .../com/zeoflow/memo/DefaultMemoFacade.java | 18 +++++------ .../memo/{Converter.java => IConverter.java} | 2 +- ...gInterceptor.java => ILogInterceptor.java} | 2 +- .../{MemoFacade.java => IMemoFacade.java} | 4 +-- .../memo/{Parser.java => IParser.java} | 6 ++-- .../{Serializer.java => ISerializer.java} | 2 +- .../memo/{Storage.java => IStorage.java} | 2 +- memo/src/main/java/com/zeoflow/memo/Memo.java | 2 +- .../java/com/zeoflow/memo/MemoBuilder.java | 30 +++++++++---------- .../java/com/zeoflow/memo/MemoConverter.java | 8 ++--- .../java/com/zeoflow/memo/MemoSerializer.java | 6 ++-- .../memo/SharedPreferencesStorage.java | 2 +- .../java/com/zeoflow/memo/ZsonParser.java | 2 +- 13 files changed, 43 insertions(+), 43 deletions(-) rename memo/src/main/java/com/zeoflow/memo/{Converter.java => IConverter.java} (95%) rename memo/src/main/java/com/zeoflow/memo/{LogInterceptor.java => ILogInterceptor.java} (88%) rename memo/src/main/java/com/zeoflow/memo/{MemoFacade.java => IMemoFacade.java} (96%) rename memo/src/main/java/com/zeoflow/memo/{Parser.java => IParser.java} (82%) rename memo/src/main/java/com/zeoflow/memo/{Serializer.java => ISerializer.java} (95%) rename memo/src/main/java/com/zeoflow/memo/{Storage.java => IStorage.java} (98%) diff --git a/memo/src/main/java/com/zeoflow/memo/DefaultMemoFacade.java b/memo/src/main/java/com/zeoflow/memo/DefaultMemoFacade.java index c9ecb18..8840662 100644 --- a/memo/src/main/java/com/zeoflow/memo/DefaultMemoFacade.java +++ b/memo/src/main/java/com/zeoflow/memo/DefaultMemoFacade.java @@ -1,13 +1,13 @@ package com.zeoflow.memo; -public class DefaultMemoFacade implements MemoFacade +public class DefaultMemoFacade implements IMemoFacade { - private final Storage storage; - private final Converter converter; + private final IStorage storage; + private final IConverter converter; private final Encryption encryption; - private final Serializer serializer; - private final LogInterceptor logInterceptor; + private final ISerializer serializer; + private final ILogInterceptor logInterceptor; public DefaultMemoFacade(MemoBuilder builder) { @@ -39,7 +39,7 @@ public boolean put(String key, T value) log("Memo.put -> Converted to " + plainText); if (plainText == null) { - log("Memo.put -> Converter failed"); + log("Memo.put -> IConverter failed"); return false; } @@ -132,7 +132,7 @@ public T get(String key) log("Memo.get -> Converted to : " + result); } catch (Exception e) { - log("Memo.get -> Converter failed"); + log("Memo.get -> IConverter failed"); } return result; @@ -155,7 +155,7 @@ public String encrypt(T value) log("Memo.put -> Converted to " + plainText); if (plainText == null) { - log("Memo.put -> Converter failed"); + log("Memo.put -> IConverter failed"); return ""; } @@ -223,7 +223,7 @@ public T decrypt(String value) log("Memo.get -> Converted to : " + result); } catch (Exception e) { - log("Memo.get -> Converter failed"); + log("Memo.get -> IConverter failed"); } return result; diff --git a/memo/src/main/java/com/zeoflow/memo/Converter.java b/memo/src/main/java/com/zeoflow/memo/IConverter.java similarity index 95% rename from memo/src/main/java/com/zeoflow/memo/Converter.java rename to memo/src/main/java/com/zeoflow/memo/IConverter.java index 664735a..3190825 100644 --- a/memo/src/main/java/com/zeoflow/memo/Converter.java +++ b/memo/src/main/java/com/zeoflow/memo/IConverter.java @@ -6,7 +6,7 @@ * * @see MemoConverter */ -public interface Converter +public interface IConverter { /** diff --git a/memo/src/main/java/com/zeoflow/memo/LogInterceptor.java b/memo/src/main/java/com/zeoflow/memo/ILogInterceptor.java similarity index 88% rename from memo/src/main/java/com/zeoflow/memo/LogInterceptor.java rename to memo/src/main/java/com/zeoflow/memo/ILogInterceptor.java index 3fa4fbb..755b919 100644 --- a/memo/src/main/java/com/zeoflow/memo/LogInterceptor.java +++ b/memo/src/main/java/com/zeoflow/memo/ILogInterceptor.java @@ -3,7 +3,7 @@ /** * Interceptor for all logs happens in the library */ -public interface LogInterceptor +public interface ILogInterceptor { /** diff --git a/memo/src/main/java/com/zeoflow/memo/MemoFacade.java b/memo/src/main/java/com/zeoflow/memo/IMemoFacade.java similarity index 96% rename from memo/src/main/java/com/zeoflow/memo/MemoFacade.java rename to memo/src/main/java/com/zeoflow/memo/IMemoFacade.java index 551a445..6c19af0 100644 --- a/memo/src/main/java/com/zeoflow/memo/MemoFacade.java +++ b/memo/src/main/java/com/zeoflow/memo/IMemoFacade.java @@ -1,6 +1,6 @@ package com.zeoflow.memo; -public interface MemoFacade +public interface IMemoFacade { boolean put(String key, T value); @@ -25,7 +25,7 @@ public interface MemoFacade void destroy(); - class EmptyMemoFacade implements MemoFacade + class EmptyMemoFacade implements IMemoFacade { @Override diff --git a/memo/src/main/java/com/zeoflow/memo/Parser.java b/memo/src/main/java/com/zeoflow/memo/IParser.java similarity index 82% rename from memo/src/main/java/com/zeoflow/memo/Parser.java rename to memo/src/main/java/com/zeoflow/memo/IParser.java index a7ecebd..cc7d152 100644 --- a/memo/src/main/java/com/zeoflow/memo/Parser.java +++ b/memo/src/main/java/com/zeoflow/memo/IParser.java @@ -4,14 +4,14 @@ /** * Intermediate layer that handles serialization/deserialization for the end result. - * This is not the same as {@link Serializer}. This interface is only used to convert the intermediate value - * into String or vice-versa to be used for {@link Storage} + * This is not the same as {@link ISerializer}. This interface is only used to convert the intermediate value + * into String or vice-versa to be used for {@link IStorage} * *

Use custom implementation if built-in implementation is not enough.

* * @see ZsonParser */ -public interface Parser +public interface IParser { /** diff --git a/memo/src/main/java/com/zeoflow/memo/Serializer.java b/memo/src/main/java/com/zeoflow/memo/ISerializer.java similarity index 95% rename from memo/src/main/java/com/zeoflow/memo/Serializer.java rename to memo/src/main/java/com/zeoflow/memo/ISerializer.java index effe75e..8fdfb7e 100644 --- a/memo/src/main/java/com/zeoflow/memo/Serializer.java +++ b/memo/src/main/java/com/zeoflow/memo/ISerializer.java @@ -7,7 +7,7 @@ * * @see MemoSerializer */ -public interface Serializer +public interface ISerializer { /** diff --git a/memo/src/main/java/com/zeoflow/memo/Storage.java b/memo/src/main/java/com/zeoflow/memo/IStorage.java similarity index 98% rename from memo/src/main/java/com/zeoflow/memo/Storage.java rename to memo/src/main/java/com/zeoflow/memo/IStorage.java index 7f6d81a..e25bfc6 100644 --- a/memo/src/main/java/com/zeoflow/memo/Storage.java +++ b/memo/src/main/java/com/zeoflow/memo/IStorage.java @@ -7,7 +7,7 @@ * * @see SharedPreferencesStorage */ -public interface Storage +public interface IStorage { /** diff --git a/memo/src/main/java/com/zeoflow/memo/Memo.java b/memo/src/main/java/com/zeoflow/memo/Memo.java index df88e48..ffc93b0 100644 --- a/memo/src/main/java/com/zeoflow/memo/Memo.java +++ b/memo/src/main/java/com/zeoflow/memo/Memo.java @@ -10,7 +10,7 @@ public final class Memo { - static MemoFacade memoFacade = new MemoFacade.EmptyMemoFacade(); + static IMemoFacade memoFacade = new IMemoFacade.EmptyMemoFacade(); private Memo() { diff --git a/memo/src/main/java/com/zeoflow/memo/MemoBuilder.java b/memo/src/main/java/com/zeoflow/memo/MemoBuilder.java index d4fa205..eaf7876 100644 --- a/memo/src/main/java/com/zeoflow/memo/MemoBuilder.java +++ b/memo/src/main/java/com/zeoflow/memo/MemoBuilder.java @@ -17,12 +17,12 @@ public class MemoBuilder private static final String STORAGE_TAG_DO_NOT_CHANGE = "MemoStorage"; private final Context context; - private Storage cryptoStorage; - private Converter converter; - private Parser parser; + private IStorage cryptoStorage; + private IConverter converter; + private IParser parser; private Encryption encryption; - private Serializer serializer; - private LogInterceptor logInterceptor; + private ISerializer serializer; + private ILogInterceptor logInterceptor; public MemoBuilder() { @@ -34,7 +34,7 @@ public MemoBuilder(Context context) this.context = context.getApplicationContext(); } - LogInterceptor getLogInterceptor() + ILogInterceptor getLogInterceptor() { if (logInterceptor == null) { @@ -45,12 +45,12 @@ LogInterceptor getLogInterceptor() } return logInterceptor; } - public MemoBuilder setLogInterceptor(LogInterceptor logInterceptor) + public MemoBuilder setLogInterceptor(ILogInterceptor logInterceptor) { this.logInterceptor = logInterceptor; return this; } - Storage getStorage() + IStorage getStorage() { if (cryptoStorage == null) { @@ -58,12 +58,12 @@ Storage getStorage() } return cryptoStorage; } - public MemoBuilder setStorage(Storage storage) + public MemoBuilder setStorage(IStorage storage) { this.cryptoStorage = storage; return this; } - Converter getConverter() + IConverter getConverter() { if (converter == null) { @@ -71,12 +71,12 @@ Converter getConverter() } return converter; } - public MemoBuilder setConverter(Converter converter) + public MemoBuilder setConverter(IConverter converter) { this.converter = converter; return this; } - Parser getParser() + IParser getParser() { if (parser == null) { @@ -84,7 +84,7 @@ Parser getParser() } return parser; } - public MemoBuilder setParser(Parser parser) + public MemoBuilder setParser(IParser parser) { this.parser = parser; return this; @@ -106,7 +106,7 @@ public MemoBuilder setEncryption(Encryption encryption) this.encryption = encryption; return this; } - Serializer getSerializer() + ISerializer getSerializer() { if (serializer == null) { @@ -114,7 +114,7 @@ Serializer getSerializer() } return serializer; } - public MemoBuilder setSerializer(Serializer serializer) + public MemoBuilder setSerializer(ISerializer serializer) { this.serializer = serializer; return this; diff --git a/memo/src/main/java/com/zeoflow/memo/MemoConverter.java b/memo/src/main/java/com/zeoflow/memo/MemoConverter.java index a2edbb2..9354969 100644 --- a/memo/src/main/java/com/zeoflow/memo/MemoConverter.java +++ b/memo/src/main/java/com/zeoflow/memo/MemoConverter.java @@ -15,16 +15,16 @@ * Serializable types will be encoded/decoded object stream * Not serializable objects will be encoded/decoded by parser */ -final class MemoConverter implements Converter +final class MemoConverter implements IConverter { - private final Parser parser; + private final IParser parser; - public MemoConverter(Parser parser) + public MemoConverter(IParser parser) { if (parser == null) { - throw new NullPointerException("Parser should not be null"); + throw new NullPointerException("IParser should not be null"); } this.parser = parser; } diff --git a/memo/src/main/java/com/zeoflow/memo/MemoSerializer.java b/memo/src/main/java/com/zeoflow/memo/MemoSerializer.java index 3417293..133bbbf 100644 --- a/memo/src/main/java/com/zeoflow/memo/MemoSerializer.java +++ b/memo/src/main/java/com/zeoflow/memo/MemoSerializer.java @@ -5,16 +5,16 @@ import java.util.Map; import java.util.Set; -class MemoSerializer implements Serializer +class MemoSerializer implements ISerializer { private static final char DELIMITER = '@'; private static final String INFO_DELIMITER = "#"; private static final char NEW_VERSION = 'V'; - private final LogInterceptor logInterceptor; + private final ILogInterceptor logInterceptor; - MemoSerializer(LogInterceptor logInterceptor) + MemoSerializer(ILogInterceptor logInterceptor) { this.logInterceptor = logInterceptor; } diff --git a/memo/src/main/java/com/zeoflow/memo/SharedPreferencesStorage.java b/memo/src/main/java/com/zeoflow/memo/SharedPreferencesStorage.java index c7752d3..d11aba3 100644 --- a/memo/src/main/java/com/zeoflow/memo/SharedPreferencesStorage.java +++ b/memo/src/main/java/com/zeoflow/memo/SharedPreferencesStorage.java @@ -3,7 +3,7 @@ import android.content.Context; import android.content.SharedPreferences; -final class SharedPreferencesStorage implements Storage +final class SharedPreferencesStorage implements IStorage { private final SharedPreferences preferences; diff --git a/memo/src/main/java/com/zeoflow/memo/ZsonParser.java b/memo/src/main/java/com/zeoflow/memo/ZsonParser.java index f40d6a9..1b23bc2 100644 --- a/memo/src/main/java/com/zeoflow/memo/ZsonParser.java +++ b/memo/src/main/java/com/zeoflow/memo/ZsonParser.java @@ -7,7 +7,7 @@ import java.lang.reflect.Type; -public final class ZsonParser implements Parser +public final class ZsonParser implements IParser { private final Zson zson;