diff options
Diffstat (limited to 'src/site')
-rw-r--r-- | src/site/dta.mkd | 70 | ||||
-rw-r--r-- | src/site/index.mkd | 14 |
2 files changed, 56 insertions, 28 deletions
diff --git a/src/site/dta.mkd b/src/site/dta.mkd index 6795a0f..70fc25e 100644 --- a/src/site/dta.mkd +++ b/src/site/dta.mkd @@ -50,7 +50,7 @@ public class InvoiceAdapterImpl implements DataTypeAdapter<Invoice> { }
@Override
- public Object serialize(DcKey value) {
+ public Object serialize(Invoice value) {
String json = gson().toJson(value);
PGobject pg = new PGobject();
pg.setType(getDataType());
@@ -70,7 +70,8 @@ public class InvoiceAdapterImpl implements DataTypeAdapter<Invoice> { final Invoice invoice = gson().fromJson(json, getJavaType());
return invoice;
- }
+ }
+}
---JAVA---
Here you can see how the *InvoiceTypeAdapter* defines a [Postgres JSONB data type](http://www.postgresql.org/docs/9.4/static/datatype-json.html) and automatically handles JSON (de)serialization with [Google Gson](https://code.google.com/p/google-gson) so that the database gets the content in a form that it requires but we can continue to work with objects in Java.
@@ -88,27 +89,46 @@ To simplify this, you can implement your own annotation which specifies your typ public @interface InvoiceAdapter { }
---JAVA---
-### Included DataTypeAdapters
-
-Not every DataTypeAdapter has to be a custom implementation.
-The following adapters are included in Iciql for general purpose use.
-
-- `com.iciql.adapter.JavaSerializationTypeAdapter`
-Uses Java serialization to store/retrieve your objects as BLOBs.
-- `com.iciql.adapter.GsonTypeAdapter`
-Uses Google Gson to store/retrieve your objects as TEXT.
-- `com.iciql.adapter.XmlTypeAdapter`
-Uses XStream to store/retrieve your objects as TEXT.
-- `com.iciql.adapter.postgres.GsonTypeAdapter`
-Uses Google Gson to store/retrieve your objects as JSON for Postgres.
-- `com.iciql.adapter.postgres.GsonBTypeAdapter`
-Uses Google Gson to store/retrieve your objects as JSONB for Postgres.
-- `com.iciql.adapter.postgres.XStreamTypeAdapter`
-Uses XStream to store/retrieve your objects as XML for Postgres.
-- `com.iciql.adapter.postgres.JsonStringAdapter`
-Allows you to use the Postgres JSON data type with a standard String.
-- `com.iciql.adapter.postgres.JsonbStringAdapter`
-Allows you to use the Postgres JSONB data type with a standard String.
-- `com.iciql.adapter.postgres.XmlStringAdapter`
-Allows you to use the Postgres XML data type with a standard String.
+### Included Data Type Adapters
+
+The following adapters are included in Iciql. They may require an optional dependency such as Gson, XStream, or SnakeYaml.
+
+<table class="table">
+<tr><td colspan="4"><b>Common Type Adapters</b></tr>
+<tr><td><i>Adapter</i></td><td><i>Java</i></td><td><i>SQL</i></td><td><i>Description</i></td></tr>
+
+<tr><td>com.iciql.adapter.JavaSerializationTypeAdapter</td><td>Object</td><td>BLOB</td><td>Uses Java serialization to (de)serialize your object</td></tr>
+
+<tr><td>com.iciql.adapter.GsonTypeAdapter<T></td><td><T></td><td>TEXT</td><td>
+Uses Google Gson to (de)serialize your object as JSON</td></tr>
+
+<tr><td>com.iciql.adapter.XStreamTypeAdapter</td><td>Object</td><td>TEXT</td><td>
+Uses XStream to (de)serialize your object as XML</td></tr>
+
+<tr><td>com.iciql.adapter.SnakeYamlTypeAdapter<T></td><td><T></td><td>TEXT</td><td>
+Uses SnakeYaml to (de)serialize your object as YAML</td></tr>
+
+<tr><td colspan="4"><b>PostgreSQL Type Adapters</b></tr>
+<tr><td><i>Object Adapters</i></td><td><i>Java</i></td><td><i>SQL</i></td><td><i>Description</i></td></tr>
+
+<tr><td>com.iciql.adapter.postgresql.JsonObjectAdapter<T></td><td><T></td><td>JSON</td><td>
+Uses Google Gson to (de)serialize your object as JSON</td></tr>
+
+<tr><td>com.iciql.adapter.postgresql.JsonbObjectAdapter<T></td><td><T></td><td>JSONB</td><td>
+Uses Google Gson to (de)serialize your object as JSONB</td></tr>
+
+<tr><td>com.iciql.adapter.postgresql.XmlObjectAdapter</td><td>Object</td><td>XML</td><td>
+Uses XStream to (de)serialize your object as XML</td></tr>
+
+<tr><td colspan="4"><i>String Adapters</i></td></tr>
+
+<tr><td>com.iciql.adapter.postgresql.JsonStringAdapter</td><td>String</td><td>JSON</td><td>
+Maps the JSON data type to a java.lang.String</td></tr>
+
+<tr><td>com.iciql.adapter.postgresql.JsonbStringAdapter</td><td>String</td><td>JSONB</td><td>
+Maps the JSONB data type to a java.lang.String</td></tr>
+
+<tr><td>com.iciql.adapter.postgresql.XmlStringAdapter</td><td>String</td><td>XML</td><td>
+Maps the XML data type to a java.lang.String</td></tr>
+</table>
diff --git a/src/site/index.mkd b/src/site/index.mkd index a79233c..b9fc549 100644 --- a/src/site/index.mkd +++ b/src/site/index.mkd @@ -17,7 +17,7 @@ iciql **is not**... ### fluent, type-safe SQL DSL with rich object mapping
-Born from the unfinished [JaQu][jaqu] subproject of H2 in August 2011, Iciql has advanced the codebase & DSL greatly. It supports more SQL syntax, more SQL data types, and all standard JDBC object types.
+Born from the unfinished [JaQu][jaqu] subproject of H2 in August 2011, Iciql has [advanced the codebase](jaqu_comparison.html) & DSL greatly. It supports more SQL syntax, more SQL data types, and all standard JDBC object types.
---JAVA---
try (Db db = Db.open("jdbc:h2:mem:iciql")) {
@@ -32,7 +32,7 @@ try (Db db = Db.open("jdbc:h2:mem:iciql")) { ### dynamic, annotated DAO with standard crud operations
-Inspired by [JDBI](http://jdbi.org), Iciql offers a similar Dao feature. There are some clear benefits to using SQL directly rather than SQL-through-a-DSL so use them both where it makes the most sense for your need.
+Inspired by JDBI, Iciql offers a similar [DAO feature](dao.html). There are some clear benefits to using SQL directly rather than SQL-through-a-DSL so use each one where it makes the mose sense.
---JAVA---
// Define your DAO with SQL annotations and optional type adapters
@@ -83,6 +83,14 @@ try (Db db = Db.open("jdbc:h2:mem:iciql")) { }
---JAVA---
+### flexible field data types
+
+The [Data Type Adapter feature](dta.html) allows you to customize how your SQL column data types map to/from Java objects.
+
+This is very useful for mapping your field domain models to SQL without having to flatten them out to additional columns within your table. In other words, you can use your database as an object store at the column level by implementing a `@TypeAdapter` (de)serialization step.
+
+You might use this to take advantage of the underlying database's type system. For example, PostgreSQL ships with the compelling JSON/JSONB/XML data types. Iciql provides String and Object adapters to facilitate use of those data types.
+
### Supported Databases (Unit-Tested)
- [H2](http://h2database.com) ${h2.version}
- [HSQLDB](http://hsqldb.org) ${hsqldb.version}
@@ -103,7 +111,7 @@ iciql is distributed under the terms of the [Apache Software Foundation license, [jaqu]: http://h2database.com/html/jaqu.html "H2 JaQu project"
[orm]: http://en.wikipedia.org/wiki/Object-relational_mapping "Object Relational Mapping"
[jooq]: http://jooq.sourceforge.net "jOOQ"
-[querydsl]: http://source.mysema.com/display/querydsl/Querydsl "Querydsl"
+[querydsl]: http://source.mysema.com/display/querydsl/Querydsl "QueryDSL"
[hibernate]: http://www.hibernate.org "Hibernate"
[mybatis]: http://www.mybatis.org "mybatis"
[github]: http://github.com/gitblit/iciql "iciql git repository"
|