-
Notifications
You must be signed in to change notification settings - Fork 16
Persist in JSON format
xcesco edited this page Jan 24, 2017
·
4 revisions
The annotation @BindType
allows to persist a class instance.
@BindType
public class User {
public String email;
public String name;
public String surname;
}
As default, @BindType
annotation bind all public fields and attribute with getter/setter.
JSON persistence context is the only available context for default, so you does not need to registry it.
Code to generate an JSON version of User
instance class:
BinderContext binderContext=KriptonBinder.jsonBind();
String result = binderContext.serialize(bean);
Generated JSON will be similar to:
{
"email": "[email protected]",
"name": "Tonj",
"surname": "Manero",
"username": "1234
}
Kripton does not support (in current release) pretty printing, so output will be a inline JSON. I format JSON for readability reason.
Code to parse JSON and create a User
instance:
User user=binderContext.parse(result, User.class);
- Introduction
- Goals & Features
- Kotlin
- Immutable or Mutable Pojo
- Annotation Processor Args
- Credits
- Articles
- Benchmarks
- Setup
- Tutorial
- Usage
- Dependencies and inspirations
- Stackoverflow
- Documentation
- SQL logging
- Data source options
- Indices
- SQL Type adapter
- Global SQL Type adapter
- Constraints
- Live data: welcome Architectural components!!
- Paged Live data
- Dynamic parts
- Transactional and batch operations
- Async Transactional and batch operations
- Global transaction
- Support for immutable POJO
- Generate Content provider
- Generate Database schema generation
- Database migration
- BindSqlColumn
- BindContentProvider
- BindContentProviderEntry
- BindContentProviderPath
- BindDao
- BindDaoMany2Many
- BindDataSource
- BindDataSourceOptions
- BindDataSourceUpdateTask
- BindIndex
- BindSqlRelation
- BindSqlAdapter
- BindSqlChildSelect
- BindSqlDelete
- BindSqlDynamicOrderBy
- BindSqlDynamicWhere
- BindSqlDynamicWhereParams
- BindSqlInsert
- BindSqlPageSize
- BindSqlParam
- BindSqlSelect
- BindSqlUpdate
- BindSqlType
- BindSqlTransaction