Skip to content
main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

platform API License Bintray Bintray Android Arsenal Jitpack

by Romell Domínguez

Downloads Dashboard

Data Studio

Replace the following latestVersion annotation with java latest Bintray version, kotlin latest Bintray version

Add the following in your app's build.gradle file:

repositories {
    jcenter()
}
dependencies {
    implementation 'com.romellfudi.store:fudi-store:{latestVersion}'
    implementation 'com.romellfudi.store:kotlin-fudi-store:{latestVersion}'
}

How implement

Your class tag with JsonIgnoreProperties annotation and implements set & get. Note: In kotlin language you must add the Annotation @Fudi on your data class, otherwise the extensions (save, load clear) would be ignored:

@JsonIgnoreProperties(ignoreUnknown = true)
public class ObjectBean {
    private String data;
    private ArrayList<ObjectDetailBean> objectDetailBeans;
    // need getters
    ...
}
@Fudi
@JsonIgnoreProperties(ignoreUnknown = true)
data class Class(var state: Boolean=false,
                            var value: Int=-1,
                            var valueDouble: Double=0.0,
                            var details: ArrayList<String>?=null)

In case attributes don't have setter method, the reference stores nullvalue

Save different objects:

SharePreferenced.save(myObjectClass,MyClass.class,"OBJ1");
// Using extensions & @Fudi 
val dataObject = Class(false,65,8.9,0,arrayListOf("hello", "wait", "bye"))
dataObject.save(tag="optional") // storage data
dataObject.load(tag="optional") // restore data or returns default object
dataObject.clear()

License

Copyright 2016 Romell D.Z.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

2016, November