-
Notifications
You must be signed in to change notification settings - Fork 16
Persist in XML format
xcesco edited this page Jan 20, 2017
·
12 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 is converted by Kripton, produce XML similar to:
<?xml version="1.0" encoding="utf-8"?>
<user>
<email>[email protected]</email>
<name>Tonj</name>
<surname>Manero</surname>
<username>1234</username>
</user>
Kripton does not support (in current release) pretty printing, so output will be a inline XML. Code if formatted for readability reason.
As default behaviour, @BindType
annotation persists all public fields and attribute with getter/setter.
Before serialize/deserialize java object in XML format, you need to registry the XML context:
KriptonBinder.registryBinder(new KriptonXmlContext());
Code to generate an XML version of User
instance class:
BinderContext binderContext=KriptonBinder.bind(BinderType.XML);
String result = binderContext.serialize(bean);
Code to parse XML and create a User
instance:
BinderContext binderContext=KriptonBinder.bind(BinderType.XML);
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