public DateProtofieldAccessor(int tag, String name, boolean nullable, String columnName) { super( tag, name, nullable, columnName, (ProtoStreamWriter outProtobuf, Date value) -> outProtobuf.writeLong( name, value.getTime() ), (ProtoStreamReader reader) -> { Long utcTimestamp = reader.readLong( name ); if ( utcTimestamp != null ) { Date d = new Date(); d.setTime( utcTimestamp ); return d; } else { return null; } } ); }
public CalendarDateProtofieldAccessor(int tag, final String name, boolean nullable, String columnName) { super( tag, name, nullable, columnName, (ProtoStreamWriter outProtobuf, Calendar value) -> outProtobuf.writeLong( name, value.getTimeInMillis() ), (ProtoStreamReader reader) -> { //TODO should we map this as a composite object, to encode both the utcTimestamp and the timezone? Long utcTimestamp = reader.readLong( name ); if ( utcTimestamp != null ) { Calendar c = Calendar.getInstance(); c.setTimeInMillis( utcTimestamp ); return c; } else { return null; } } ); }
public TimestampProtofieldAccessor(int tag, String name, boolean nullable, String columnName) { super( tag, name, nullable, columnName, (ProtoStreamWriter outProtobuf, Date value) -> outProtobuf.writeLong( name, value.getTime() ), (ProtoStreamReader reader) -> { Long utcTimestamp = reader.readLong( name ); if ( utcTimestamp != null ) { Date d = new Timestamp( utcTimestamp ); return d; } else { return null; } } ); }
@Override public void writeTo(ProtoStreamWriter out, InfinispanSessionData sdata) throws IOException { out.writeInt("version", VERSION); out.writeString("id", sdata.getId()); // session id out.writeString("contextPath", sdata.getContextPath()); // context path out.writeString("vhost", sdata.getVhost()); // first vhost out.writeLong("accessed", sdata.getAccessed());// accessTime out.writeLong("lastAccessed", sdata.getLastAccessed()); // lastAccessTime out.writeLong("created", sdata.getCreated()); // time created out.writeLong("cookieSet", sdata.getCookieSet());// time cookie was set out.writeString("lastNode", sdata.getLastNode()); // name of last node // managing out.writeLong("expiry", sdata.getExpiry()); out.writeLong("maxInactiveMs", sdata.getMaxInactiveMs()); sdata.serializeAttributes(); out.writeBytes("attributes", sdata.getSerializedAttributes()); } }
public TimeProtofieldAccessor(int tag, String name, boolean nullable, String columnName) { super( tag, name, nullable, columnName, (MessageMarshaller.ProtoStreamWriter outProtobuf, Time value) -> outProtobuf.writeLong( name, value.getTime() ), (MessageMarshaller.ProtoStreamReader reader) -> { Long utcTimestamp = reader.readLong( name ); if ( utcTimestamp != null ) { Time d = new Time( utcTimestamp ); return d; } else { return null; } } ); }
@Override public void writeTo(ProtoStreamWriter writer, Transaction transaction) throws IOException { writer.writeInt("id", transaction.getId()); writer.writeString("description", transaction.getDescription()); writer.writeString("longDescription", transaction.getLongDescription()); writer.writeString("notes", transaction.getNotes()); writer.writeInt("accountId", transaction.getAccountId()); writer.writeLong("date", transaction.getDate().getTime()); writer.writeDouble("amount", transaction.getAmount()); writer.writeBoolean("isDebit", transaction.isDebit()); writer.writeBoolean("isValid", transaction.isValid()); } }
public LongProtofieldAccessor(final int tag, final String name, final boolean nullable, final String columnName) { super( tag, name, nullable, columnName, (ProtoStreamWriter outProtobuf, Long value) -> outProtobuf.writeLong( name, value ), (ProtoStreamReader reader) -> reader.readLong( name ) ); }
@Override public void writeTo(ProtoStreamWriter writer, QueryRequest queryRequest) throws IOException { writer.writeString("queryString", queryRequest.getQueryString()); writer.writeLong("startOffset", queryRequest.getStartOffset()); writer.writeInt("maxResults", queryRequest.getMaxResults()); writer.writeCollection("namedParameters", queryRequest.getNamedParameters(), NamedParameter.class); writer.writeString("indexedQueryMode", queryRequest.getIndexedQueryMode()); }
@Override public void writeTo(ProtoStreamWriter writer, QueryResponse queryResponse) throws IOException { writer.writeInt("numResults", queryResponse.numResults); writer.writeInt("projectionSize", queryResponse.projectionSize); writer.writeCollection("results", queryResponse.results, WrappedMessage.class); writer.writeLong("totalResults", queryResponse.totalResults); }