KunMinX 专注 “业务架构”,致力消除敏捷开发过程中 “不可预期问题”。
kunminx / keyvaluex Goto Github PK
View Code? Open in Web Editor NEW消除 Android 项目 Key-Value 样板代码
License: Apache License 2.0
消除 Android 项目 Key-Value 样板代码
License: Apache License 2.0
KunMinX 专注 “业务架构”,致力消除敏捷开发过程中 “不可预期问题”。
我尝试着集成在项目中测试,在启动 Activity
发现会报 java.lang.ClassNotFoundException: com.xxx.xxx.xxx.ConfigsImpl
的错误,集成使用方式如下:
implementation 'com.github.KunMinX.KeyValueX:keyvalue:3.2.0-beta'
annotationProcessor 'com.github.KunMinX.KeyValueX:keyvalue-compiler:3.2.0-beta'
@KeyValueX
public interface Configs {
KeyValueBoolean isLogin();
}
public class WelcomeActivity extends AppCompatActivity {
Configs configs = KeyValueProvider.get(Configs.class); // 这行会报错
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
...
LogUtils.wLog().e("isLogin=" + configs.isLogin().get());
configs.isLogin().set(!configs.isLogin().get());
}
}
并且 crash:
Caused by: java.lang.ClassCastException: java.lang.Object cannot be cast to xxx.xxx.xxx.Configs
我的这个错误是混淆没有关系,是因为没有生成具体的实现类有关。请问这个有什么解决办法吗?
我看源码,底层存储使用的还是SP,要是能支持替换为MMKV,或者DataStore就好了。应该提供一组接口,让使用者自行设置内核,不设置才使用默认的SP。
请问大佬支持kotlin项目吗
比如有这么个场景,用户退出登录需要清空key-value,目前没有暴露这个方法吧,是直接调用 SPUtils.getInstance().clear()
吗
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.