https://github.com/sunng87/bason
annotaion driven bson mapping tookit
https://github.com/sunng87/bason
Last synced: 8 months ago
JSON representation
annotaion driven bson mapping tookit
- Host: GitHub
- URL: https://github.com/sunng87/bason
- Owner: sunng87
- License: apache-2.0
- Created: 2010-08-18T14:21:55.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2010-10-10T02:10:24.000Z (over 15 years ago)
- Last Synced: 2025-03-31T21:27:51.018Z (9 months ago)
- Language: Java
- Homepage:
- Size: 156 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
Bason
=====
Bason is a Java toolkit to generate [BSON](http://bsonspec.org "bson web site") serializer automatically.
The mapper class configured in bason.properties is generated at compile time which has no nagetive impact on performance
(comparing with traditional reflection way).
Usage
-----
Annotate your Java bean with @BsonDocument to declare that this bean can be serialized
to or deserialized from bson.
@BsonDocument
public class Passenger {
private double packageWeight;
public double getPackageWeight() {
return packageWeight;
}
public void setPackageWeight(double packageWeight) {
this.packageWeight = packageWeight;
}
}
For maven user, then add such segment on certain part of your pom.xml
org.apache.maven.plugins
maven-compiler-plugin
1.6
1.6
info.sunng.bason.internal.BasonProcessor
if you are not maven user, add corresponding javac directive when compiling.
run `maven compile` to generate Bason manager class you defined in *bason.properties*.
See the example project for detail.
Bason snapshot builds are available at [Sonatype OSS repository](https://oss.sonatype.org/content/repositories/snapshots/ "copy the link to repository section of your pom"). Put this segment in you pom.xml:
sonatype oss snapshots
always
https://oss.sonatype.org/content/repositories/snapshots/
info.sunng.bason
bason-annotation
compile
info.sunng.bason
bason-internal
compile
org.mongodb
mongo-java-driver
Currently, you have to depend on whole mongo-java-driver which is considered to be verbose.
I reported [an issue](http://jira.mongodb.org/browse/JAVA-152 "mongodb jira") to mongodb team. It is said that the bson packages will be distributed separately since the version of 2.2.