-
Notifications
You must be signed in to change notification settings - Fork 16
Persist in YAML format
xcesco edited this page Sep 5, 2017
·
10 revisions
The annotation @BindType
allows to persist Java class instance. For User
class
@BindType
public class User {
public String email;
public String name;
public String surname;
}
When it is converted by Kripton, it will be converted in a YAML rapresentation similar to:
---
email: "[email protected]"
name: "Tonj"
surname: "Manero"
username: "1234"
As default behaviour, @BindType
annotation persists all public fields and attribute with getter/setter.
It's supposed that you already include kripton-android-library
or kripton-library
in your dependencies.
Before serialize/deserialize java object in YAML format, you need to include kripton-dataformat-yaml
in project's dependency via maven:
<dependency>
<groupId>com.abubusoft</groupId>
<artifactId>kripton-dataformat-yaml</artifactId>
<version>2.0.1</version>
</dependency>
Or via gradle
compile 'com.abubusoft:kripton-dataformat-yaml:2.0.1'
Code to generate an YAML version of User
instance class:
BinderContext binderContext=KriptonBinder.bind(BinderType.YAML);
String result = binderContext.serialize(bean);
Code to parse YAML and create a User
instance:
BinderContext binderContext=KriptonBinder.bind(BinderType.YAML);
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