public BigDecimalProtofieldAccessor(int tag, String name, boolean nullable, String columnName) { super( tag, name, nullable, columnName, (ProtoStreamWriter outProtobuf, BigDecimal value) -> outProtobuf.writeBytes( name, value.toBigInteger().toByteArray() ), (ProtoStreamReader reader) -> { byte[] readBytes = reader.readBytes( name ); if ( readBytes != null ) { BigInteger bi = new BigInteger( readBytes ); BigDecimal bd = new BigDecimal( bi ); return bd; } return null; } ); }
public BigIntegerProtofieldAccessor(int tag, String name, boolean nullable, String columnName) { super( tag, name, nullable, columnName, (ProtoStreamWriter outProtobuf, BigInteger value) -> outProtobuf.writeBytes( name, value.toByteArray() ), (ProtoStreamReader reader) -> { byte[] readBytes = reader.readBytes( name ); if ( readBytes != null ) { return new BigInteger( readBytes ); } return null; } ); }
@Override public void writeTo(ProtoStreamWriter writer, FilterResult filterResult) throws IOException { if (filterResult.getProjection() == null) { // skip marshalling the instance if there is a projection writer.writeBytes("instance", (byte[]) filterResult.getInstance()); } else { WrappedMessage[] p = new WrappedMessage[filterResult.getProjection().length]; for (int i = 0; i < p.length; i++) { p[i] = new WrappedMessage(filterResult.getProjection()[i]); } writer.writeArray("projection", p, WrappedMessage.class); } if (filterResult.getSortProjection() != null) { WrappedMessage[] p = new WrappedMessage[filterResult.getSortProjection().length]; for (int i = 0; i < p.length; i++) { p[i] = new WrappedMessage(filterResult.getSortProjection()[i]); } writer.writeArray("sortProjection", p, WrappedMessage.class); } }
@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()); } }
@Override public void writeTo(ProtoStreamWriter writer, ContinuousQueryResult continuousQueryResult) throws IOException { writer.writeObject("resultType", continuousQueryResult.resultType, ResultType.class); writer.writeBytes("key", continuousQueryResult.key); if (continuousQueryResult.projection == null) { // skip marshalling the instance if there is a projection writer.writeBytes("value", continuousQueryResult.value); } else { WrappedMessage[] p = new WrappedMessage[continuousQueryResult.projection.length]; for (int i = 0; i < p.length; i++) { p[i] = new WrappedMessage(continuousQueryResult.projection[i]); } writer.writeArray("projection", p, WrappedMessage.class); } }
public PrimitiveBytearrayProtofieldAccessor(int tag, String name, boolean nullable, String columnName) { super( tag, name, nullable, columnName, (ProtoStreamWriter outProtobuf, byte[] value) -> outProtobuf.writeBytes( name, value ), (ProtoStreamReader reader) -> reader.readBytes( name ) ); }