aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/com/iciql/adapter/postgresql
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2016-04-05 12:27:55 -0400
committerJames Moger <james.moger@gitblit.com>2016-04-05 12:27:55 -0400
commitbb87e621eefd97872aa1a619d38c166b2f07db84 (patch)
treed7199be13f0015e218ae2ded4ebd8af11b955845 /src/main/java/com/iciql/adapter/postgresql
parent98bb5dc01796728de5b18f84e19766276d12d1db (diff)
downloadiciql-bb87e621eefd97872aa1a619d38c166b2f07db84.tar.gz
iciql-bb87e621eefd97872aa1a619d38c166b2f07db84.zip
Reformat project with default IntelliJ settings
Diffstat (limited to 'src/main/java/com/iciql/adapter/postgresql')
-rw-r--r--src/main/java/com/iciql/adapter/postgresql/JsonObjectAdapter.java40
-rw-r--r--src/main/java/com/iciql/adapter/postgresql/JsonStringAdapter.java73
-rw-r--r--src/main/java/com/iciql/adapter/postgresql/JsonbObjectAdapter.java40
-rw-r--r--src/main/java/com/iciql/adapter/postgresql/JsonbStringAdapter.java73
-rw-r--r--src/main/java/com/iciql/adapter/postgresql/XmlObjectAdapter.java9
-rw-r--r--src/main/java/com/iciql/adapter/postgresql/XmlStringAdapter.java73
6 files changed, 150 insertions, 158 deletions
diff --git a/src/main/java/com/iciql/adapter/postgresql/JsonObjectAdapter.java b/src/main/java/com/iciql/adapter/postgresql/JsonObjectAdapter.java
index 118cfc1..91f989a 100644
--- a/src/main/java/com/iciql/adapter/postgresql/JsonObjectAdapter.java
+++ b/src/main/java/com/iciql/adapter/postgresql/JsonObjectAdapter.java
@@ -15,38 +15,36 @@
*/
package com.iciql.adapter.postgresql;
-import java.sql.SQLException;
-
+import com.iciql.adapter.GsonTypeAdapter;
import org.postgresql.util.PGobject;
-import com.iciql.adapter.GsonTypeAdapter;
+import java.sql.SQLException;
/**
* Postgres JSON data type adapter maps a JSON column to a domain object using
* Google GSON.
*
- * @author James Moger
- *
* @param <T>
+ * @author James Moger
*/
public abstract class JsonObjectAdapter<T> extends GsonTypeAdapter<T> {
- @Override
- public String getDataType() {
- return "json";
- }
+ @Override
+ public String getDataType() {
+ return "json";
+ }
- @Override
- public Object serialize(T value) {
+ @Override
+ public Object serialize(T value) {
- String json = gson().toJson(value);
- PGobject pg = new PGobject();
- pg.setType(getDataType());
- try {
- pg.setValue(json);
- } catch (SQLException e) {
- // not thrown on base PGobject
- }
- return pg;
- }
+ String json = gson().toJson(value);
+ PGobject pg = new PGobject();
+ pg.setType(getDataType());
+ try {
+ pg.setValue(json);
+ } catch (SQLException e) {
+ // not thrown on base PGobject
+ }
+ return pg;
+ }
}
diff --git a/src/main/java/com/iciql/adapter/postgresql/JsonStringAdapter.java b/src/main/java/com/iciql/adapter/postgresql/JsonStringAdapter.java
index 01d2834..5295d52 100644
--- a/src/main/java/com/iciql/adapter/postgresql/JsonStringAdapter.java
+++ b/src/main/java/com/iciql/adapter/postgresql/JsonStringAdapter.java
@@ -15,49 +15,48 @@
*/
package com.iciql.adapter.postgresql;
-import java.sql.SQLException;
-
-import org.postgresql.util.PGobject;
-
import com.iciql.Iciql.DataTypeAdapter;
import com.iciql.Iciql.Mode;
+import org.postgresql.util.PGobject;
+
+import java.sql.SQLException;
/**
* Handles transforming raw strings to/from the Postgres JSON data type.
*/
public class JsonStringAdapter implements DataTypeAdapter<String> {
- protected Mode mode;
-
- @Override
- public void setMode(Mode mode) {
- this.mode = mode;
- }
-
- @Override
- public String getDataType() {
- return "json";
- }
-
- @Override
- public Class<String> getJavaType() {
- return String.class;
- }
-
- @Override
- public Object serialize(String value) {
- PGobject pg = new PGobject();
- pg.setType(getDataType());
- try {
- pg.setValue(value);
- } catch (SQLException e) {
- // not thrown on base PGobject
- }
- return pg;
- }
-
- @Override
- public String deserialize(Object value) {
- return value.toString();
- }
+ protected Mode mode;
+
+ @Override
+ public void setMode(Mode mode) {
+ this.mode = mode;
+ }
+
+ @Override
+ public String getDataType() {
+ return "json";
+ }
+
+ @Override
+ public Class<String> getJavaType() {
+ return String.class;
+ }
+
+ @Override
+ public Object serialize(String value) {
+ PGobject pg = new PGobject();
+ pg.setType(getDataType());
+ try {
+ pg.setValue(value);
+ } catch (SQLException e) {
+ // not thrown on base PGobject
+ }
+ return pg;
+ }
+
+ @Override
+ public String deserialize(Object value) {
+ return value.toString();
+ }
} \ No newline at end of file
diff --git a/src/main/java/com/iciql/adapter/postgresql/JsonbObjectAdapter.java b/src/main/java/com/iciql/adapter/postgresql/JsonbObjectAdapter.java
index 6d8ad2c..947778b 100644
--- a/src/main/java/com/iciql/adapter/postgresql/JsonbObjectAdapter.java
+++ b/src/main/java/com/iciql/adapter/postgresql/JsonbObjectAdapter.java
@@ -15,38 +15,36 @@
*/
package com.iciql.adapter.postgresql;
-import java.sql.SQLException;
-
+import com.iciql.adapter.GsonTypeAdapter;
import org.postgresql.util.PGobject;
-import com.iciql.adapter.GsonTypeAdapter;
+import java.sql.SQLException;
/**
* Postgres JSONB data type adapter maps a JSONB column to a domain object using
* Google GSON.
*
- * @author James Moger
- *
* @param <T>
+ * @author James Moger
*/
public abstract class JsonbObjectAdapter<T> extends GsonTypeAdapter<T> {
- @Override
- public String getDataType() {
- return "jsonb";
- }
+ @Override
+ public String getDataType() {
+ return "jsonb";
+ }
- @Override
- public Object serialize(T value) {
+ @Override
+ public Object serialize(T value) {
- String json = gson().toJson(value);
- PGobject pg = new PGobject();
- pg.setType(getDataType());
- try {
- pg.setValue(json);
- } catch (SQLException e) {
- // not thrown on base PGobject
- }
- return pg;
- }
+ String json = gson().toJson(value);
+ PGobject pg = new PGobject();
+ pg.setType(getDataType());
+ try {
+ pg.setValue(json);
+ } catch (SQLException e) {
+ // not thrown on base PGobject
+ }
+ return pg;
+ }
}
diff --git a/src/main/java/com/iciql/adapter/postgresql/JsonbStringAdapter.java b/src/main/java/com/iciql/adapter/postgresql/JsonbStringAdapter.java
index 9d7388b..88d69c6 100644
--- a/src/main/java/com/iciql/adapter/postgresql/JsonbStringAdapter.java
+++ b/src/main/java/com/iciql/adapter/postgresql/JsonbStringAdapter.java
@@ -15,49 +15,48 @@
*/
package com.iciql.adapter.postgresql;
-import java.sql.SQLException;
-
-import org.postgresql.util.PGobject;
-
import com.iciql.Iciql.DataTypeAdapter;
import com.iciql.Iciql.Mode;
+import org.postgresql.util.PGobject;
+
+import java.sql.SQLException;
/**
* Handles transforming raw strings to/from the Postgres JSONB data type.
*/
public class JsonbStringAdapter implements DataTypeAdapter<String> {
- protected Mode mode;
-
- @Override
- public void setMode(Mode mode) {
- this.mode = mode;
- }
-
- @Override
- public String getDataType() {
- return "jsonb";
- }
-
- @Override
- public Class<String> getJavaType() {
- return String.class;
- }
-
- @Override
- public Object serialize(String value) {
- PGobject pg = new PGobject();
- pg.setType(getDataType());
- try {
- pg.setValue(value);
- } catch (SQLException e) {
- // not thrown on base PGobject
- }
- return pg;
- }
-
- @Override
- public String deserialize(Object value) {
- return value.toString();
- }
+ protected Mode mode;
+
+ @Override
+ public void setMode(Mode mode) {
+ this.mode = mode;
+ }
+
+ @Override
+ public String getDataType() {
+ return "jsonb";
+ }
+
+ @Override
+ public Class<String> getJavaType() {
+ return String.class;
+ }
+
+ @Override
+ public Object serialize(String value) {
+ PGobject pg = new PGobject();
+ pg.setType(getDataType());
+ try {
+ pg.setValue(value);
+ } catch (SQLException e) {
+ // not thrown on base PGobject
+ }
+ return pg;
+ }
+
+ @Override
+ public String deserialize(Object value) {
+ return value.toString();
+ }
} \ No newline at end of file
diff --git a/src/main/java/com/iciql/adapter/postgresql/XmlObjectAdapter.java b/src/main/java/com/iciql/adapter/postgresql/XmlObjectAdapter.java
index eba7c06..f5160d3 100644
--- a/src/main/java/com/iciql/adapter/postgresql/XmlObjectAdapter.java
+++ b/src/main/java/com/iciql/adapter/postgresql/XmlObjectAdapter.java
@@ -23,13 +23,12 @@ import com.iciql.adapter.XStreamTypeAdapter;
* XStream.
*
* @author James Moger
- *
*/
public abstract class XmlObjectAdapter extends XStreamTypeAdapter {
- @Override
- public String getDataType() {
- return "xml";
- }
+ @Override
+ public String getDataType() {
+ return "xml";
+ }
}
diff --git a/src/main/java/com/iciql/adapter/postgresql/XmlStringAdapter.java b/src/main/java/com/iciql/adapter/postgresql/XmlStringAdapter.java
index 0aea77e..a795e4f 100644
--- a/src/main/java/com/iciql/adapter/postgresql/XmlStringAdapter.java
+++ b/src/main/java/com/iciql/adapter/postgresql/XmlStringAdapter.java
@@ -15,49 +15,48 @@
*/
package com.iciql.adapter.postgresql;
-import java.sql.SQLException;
-
-import org.postgresql.util.PGobject;
-
import com.iciql.Iciql.DataTypeAdapter;
import com.iciql.Iciql.Mode;
+import org.postgresql.util.PGobject;
+
+import java.sql.SQLException;
/**
* Handles transforming raw strings to/from the Postgres XML data type.
*/
public class XmlStringAdapter implements DataTypeAdapter<String> {
- protected Mode mode;
-
- @Override
- public void setMode(Mode mode) {
- this.mode = mode;
- }
-
- @Override
- public String getDataType() {
- return "xml";
- }
-
- @Override
- public Class<String> getJavaType() {
- return String.class;
- }
-
- @Override
- public Object serialize(String value) {
- PGobject pg = new PGobject();
- pg.setType(getDataType());
- try {
- pg.setValue(value);
- } catch (SQLException e) {
- // not thrown on base PGobject
- }
- return pg;
- }
-
- @Override
- public String deserialize(Object value) {
- return value.toString();
- }
+ protected Mode mode;
+
+ @Override
+ public void setMode(Mode mode) {
+ this.mode = mode;
+ }
+
+ @Override
+ public String getDataType() {
+ return "xml";
+ }
+
+ @Override
+ public Class<String> getJavaType() {
+ return String.class;
+ }
+
+ @Override
+ public Object serialize(String value) {
+ PGobject pg = new PGobject();
+ pg.setType(getDataType());
+ try {
+ pg.setValue(value);
+ } catch (SQLException e) {
+ // not thrown on base PGobject
+ }
+ return pg;
+ }
+
+ @Override
+ public String deserialize(Object value) {
+ return value.toString();
+ }
} \ No newline at end of file