Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liushuixiaoxia/myobjsp
MyObjSp
https://github.com/liushuixiaoxia/myobjsp
Last synced: 6 days ago
JSON representation
MyObjSp
- Host: GitHub
- URL: https://github.com/liushuixiaoxia/myobjsp
- Owner: LiushuiXiaoxia
- Created: 2015-03-20T04:54:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-03-22T12:28:56.000Z (over 9 years ago)
- Last Synced: 2023-08-02T19:57:35.038Z (over 1 year ago)
- Language: Java
- Size: 4.37 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#MyObjSp
---
##Abstract
MyObjSp is like [hawk](https://github.com/orhanobut/hawk)I just rewrite hawk,becase I don't like it style for use.
MyObjSp uses:
* gson to serializable
* des to crypto
* SharedPreferences for the storage##Gradle dependency
```
repositories {
maven {
url "https://raw.githubusercontent.com/LiushuiXiaoxia/MyObjSp/repository/repository/"
}
}compile 'cn.mycommons:myobjsp:1.0'
```##Init
```java
// init with no password
MyObjSp myObjSp = MyObjSpFactory.newInstance(context, "config");
// init with password
MyObjSp myObjSp = MyObjSpFactory.newInstance(context, "config","abc123!!");
```##Put
```
// int
myObjSp.put("int", 100);
// string
myObjSp.put("string", "abc123");
// string array
myObjSp.put("string array", new String[]{"abc", "123"});
// string list
myObjSp.put("string list", Arrays.asList("abc", 123));
// object
myObjSp.put("object", new User("abc", 100, true));
// object array
myObjSp.put("object array", new User[]{
new User("abc", 100, true),
new User("abc", 100, true)
});
// object list
myObjSp.put("object list", Arrays.asList(
new User("abc", 100, true),
new User("abc", 100, true)
));
```##Get
```java
int i = myObjSp.get("int", int.class);
String s = myObjSp.get("string", String.class);String[] strintArray = myObjSp.get("string array", String[].class);
List stringList = myObjSp.get("string list", new ObjType>() {
});User user = myObjSp.get("object", User.class);
User[] users = myObjSp.get("object array", User[].class);
List userList = myObjSp.get("ojbect list", new ObjType>() {
});
```##Other
```
boolean isSuccess = myObjSp.clear();
boolean isRemoveSuccess = myObjSp.remove("key");
boolean isContains = myObjSp.contains("key");
```##Attention
```
List userList = myObjSp.get("ojbect list", new ObjType>() {
});
// The second param must like thisnew ObjType>() {} // ture
new ObjType>() // false
```