Comments (4)
Hi !
What kind of generic types for collections do you mean? Because you just can't serialize all data types, only primitives and Strings.
Of course, you can rewrite StringSetSerializer
and Preferences
classes for accepting all inheritors of Iterable
interface but you should refactor serializer class for accepting all kinds of generics like primitives and Strings. All this steps requires mid codebase refactoring and if you desire create this functionality you should provide small reference proof-of-concept of your ideas.
--
Cheers,
Alex
from binaryprefs.
I thought of collections of all primitive types, Strings
and inheritors of Persistable
.
To only rewrite the StringSetSerializer
is not a good solution in my opinion. That would imply that each value is first converted to a string which may not be good practice. I think that rewriting all serializer classes is the better way to go here. I forked this repo and did some refactoring.
For POC look for example at the BooleanSerializer which now inherits from AbstractSerializer. There is most of the code for the Collection
serialization. This new implementation does not break with the current one (except of FLAGS
and NULL
values) and also new test cases work pretty well.
Of course the Preferences
as well as the PreferencesEditor
interface have to change to accept collections and arrays but that shouldn't be the problem I guess.
from binaryprefs.
That would imply that each value is first converted to a string
nope, I meant that you should rewrite this one for working with generic types natively not String.valueOf
inherits from AbstractSerializer
This is not good enough because your base serializer has methods which is useless for most serializers and used not always, I prefer use delegates instead of inheritors, keep your code simple.
from binaryprefs.
Let me check if I got your point right:
Your idea is to only rewrite the StringSetSerializer
(apart from Preferences
) to accept all kinds of Collection
. Then each Collection
is serialized similar to a Set<String>
and only the encoding of the types change? So e.g. List<Integer>
would call a method in StringSetSerializer
but the encoding of the elements itself is then handeled by IntegerSerializer
?
from binaryprefs.
Related Issues (20)
- Problem with getting data from Set<String> HOT 5
- Incorrect state of contains method of BinaryPrefs after creation HOT 4
- editor.clear() not clears prefs HOT 4
- Add lazy evaluation for default values HOT 4
- Impossible to use without Android HOT 1
- FileChannel#write is now removed from 28 dp1 api
- How to make changes in Persistable class HOT 5
- External storage sometimes is empty line
- Preferences should be instantiated in the main thread. HOT 8
- Encryption key update HOT 4
- RuntimeException: Unable to start receiver com.ironz.binaryprefs.dump.DumpReceiver HOT 3
- Can't create preferences directory in /mnt/expand/ HOT 1
- So the inter process part is asynchronized? HOT 1
- Change UnsupportedClassVersionError error to an meaningful
- In-memory cache of byte array is vulnerable for external modifications HOT 3
- 🐞Bug with encryption HOT 3
- Create a ktx module
- Could you release the new version with current changes please? HOT 5
- Clear all prefs at once
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binaryprefs.