Skip to content

Commit

Permalink
Implement Serializable in temporal classes.
Browse files Browse the repository at this point in the history
Resolves #4
  • Loading branch information
maciejlach committed Sep 29, 2014
1 parent f1b0d84 commit f6d5a00
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 27 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
------------------------------------------------------------------------------
qJava 2.1.0 [TBA]
------------------------------------------------------------------------------

- Temporal classes are now Serializable

------------------------------------------------------------------------------
qJava 2.0.5 [2014.09.11]
------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<inceptionYear>2014</inceptionYear>

<packaging>bundle</packaging>
<version>2.0.6-SNAPSHOT</version>
<version>2.1.0-SNAPSHOT</version>

<organization>
<name>exxeleron</name>
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/com/exxeleron/qjava/QDate.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@
*/
package com.exxeleron.qjava;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
* Represents q date type.
*/
public final class QDate implements DateTime {
public final class QDate implements DateTime, Serializable {
private static final long serialVersionUID = 762296525233866140L;

private static final String NULL_STR = "0Nd";

private static final DateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");

private Date datetime;
private transient Date datetime;
private final Integer value;

/**
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/exxeleron/qjava/QDateTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@
*/
package com.exxeleron.qjava;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
* Represents q datetime type.
*/
public final class QDateTime implements DateTime {
public final class QDateTime implements DateTime, Serializable {
private static final long serialVersionUID = 762296525233866140L;

private static final String NULL_STR = "0Nz";

private static final DateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd'T'HH:mm:ss.SSS");

private Date datetime;
private Double value;
private transient Date datetime;
private final Double value;

/**
* Creates new {@link QDateTime} instance using specified q date value.
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/exxeleron/qjava/QMinute.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@
*/
package com.exxeleron.qjava;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

/**
* Represents q minute type.
*/
public final class QMinute implements DateTime {
public final class QMinute implements DateTime, Serializable {
private static final long serialVersionUID = 762296525233866140L;

private static final String NULL_STR = "0Nu";

private Date datetime;
private Integer value;
private transient Date datetime;
private final Integer value;

/**
* Creates new {@link QMinute} instance using specified q date value.
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/exxeleron/qjava/QMonth.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.exxeleron.qjava;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
Expand All @@ -23,14 +24,15 @@
/**
* Represents q month type.
*/
public final class QMonth implements DateTime {
public final class QMonth implements DateTime, Serializable {
private static final long serialVersionUID = 762296525233866140L;

private static final String NULL_STR = "0Nm";

private static final DateFormat dateFormat = new SimpleDateFormat("yyyy.MM'm'");

private Date datetime;
private Integer value;
private transient Date datetime;
private final Integer value;

/**
* Creates new {@link QMonth} instance using specified q date value.
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/exxeleron/qjava/QSecond.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@
*/
package com.exxeleron.qjava;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

/**
* Represents q second type.
*/
public final class QSecond implements DateTime {
public final class QSecond implements DateTime, Serializable {
private static final long serialVersionUID = 762296525233866140L;

private static final String NULL_STR = "0Nv";

private Date datetime;
private Integer value;
private transient Date datetime;
private final Integer value;

/**
* Creates new {@link QSecond} instance using specified q date value.
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/exxeleron/qjava/QTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@
*/
package com.exxeleron.qjava;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

/**
* Represents q time type.
*/
public final class QTime implements DateTime {
public final class QTime implements DateTime, Serializable {
private static final long serialVersionUID = 762296525233866140L;

private static final String NULL_STR = "0Nt";

private Date datetime;
private Integer value;
private transient Date datetime;
private final Integer value;

/**
* Creates new {@link QTime} instance using specified q date value.
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/com/exxeleron/qjava/QTimespan.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.exxeleron.qjava;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.NumberFormat;
Expand All @@ -25,16 +26,18 @@
/**
* Represents q timespan type.
*/
public final class QTimespan implements DateTime {
public final class QTimespan implements DateTime, Serializable {
private static final long serialVersionUID = 762296525233866140L;

private static final String NULL_STR = "0Nn";

private static final DateFormat dateFormat = new SimpleDateFormat("'D'HH:mm:ss.SSS");
private static final NumberFormat nanosFormatter = new DecimalFormat("000000");
private static final int NANOS_PER_SECOND = 1000000;
private static final long NANOS_PER_DAY = Utils.DAY_MILLIS * 1000000;

private Date datetime;
private Long value;
private transient Date datetime;
private final Long value;

/**
* Creates new {@link QTimespan} instance using specified q date value.
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/com/exxeleron/qjava/QTimestamp.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.exxeleron.qjava;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.NumberFormat;
Expand All @@ -24,15 +25,17 @@
/**
* Represents q timestamp type.
*/
public final class QTimestamp implements DateTime {
public final class QTimestamp implements DateTime, Serializable {
private static final long serialVersionUID = 762296525233866140L;

private static final String NULL_STR = "0Np";

private static final DateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd'D'HH:mm:ss.SSS");
private static final NumberFormat nanosFormatter = new DecimalFormat("000000");
private static final int NANOS_PER_SECOND = 1000000;

private Date datetime;
private Long value;
private transient Date datetime;
private final Long value;

/**
* Creates new {@link QTimestamp} instance using specified q date value.
Expand Down
Loading

0 comments on commit f6d5a00

Please sign in to comment.