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 FilterResult readFrom(ProtoStreamReader reader) throws IOException { byte[] instance = reader.readBytes("instance"); List<WrappedMessage> projection = reader.readCollection("projection", new ArrayList<>(), WrappedMessage.class); List<WrappedMessage> sortProjection = reader.readCollection("sortProjection", new ArrayList<>(), WrappedMessage.class); Object i = null; if (instance != null) { i = ProtobufUtil.fromWrappedByteArray(reader.getSerializationContext(), instance); } Object[] p = null; if (!projection.isEmpty()) { p = new Object[projection.size()]; int j = 0; for (WrappedMessage m : projection) { p[j++] = m.getValue(); } } Comparable[] sp = null; if (!sortProjection.isEmpty()) { sp = new Comparable[sortProjection.size()]; int j = 0; for (WrappedMessage m : sortProjection) { sp[j++] = (Comparable) m.getValue(); } } return new FilterResult(i, p, sp); }
@Override public InfinispanSessionData readFrom(ProtoStreamReader in) throws IOException { int version = in.readInt("version");// version of serialized session String id = in.readString("id"); // session id String cpath = in.readString("contextPath"); // context path String vhost = in.readString("vhost"); // first vhost long accessed = in.readLong("accessed");// accessTime long lastAccessed = in.readLong("lastAccessed"); // lastAccessTime long created = in.readLong("created"); // time created long cookieSet = in.readLong("cookieSet");// time cookie was set String lastNode = in.readString("lastNode"); // name of last node // managing long expiry = in.readLong("expiry"); long maxInactiveMs = in.readLong("maxInactiveMs"); InfinispanSessionData sd = new InfinispanSessionData(id, cpath, vhost, created, accessed, lastAccessed, maxInactiveMs); sd.setCookieSet(cookieSet); sd.setLastNode(lastNode); sd.setExpiry(expiry); if (version == 0) { byte[] attributeArray = in.readBytes("attributes"); sd.setSerializedAttributes(attributeArray); return sd; } else throw new IOException("Unrecognized infinispan session version " + version); }
@Override public ContinuousQueryResult readFrom(ProtoStreamReader reader) throws IOException { ResultType type = reader.readObject("resultType", ResultType.class); byte[] key = reader.readBytes("key"); byte[] value = reader.readBytes("value"); List<WrappedMessage> projection = reader.readCollection("projection", new ArrayList<>(), WrappedMessage.class); Object[] p = null; if (!projection.isEmpty()) { p = new Object[projection.size()]; int j = 0; for (WrappedMessage m : projection) { p[j++] = m.getValue(); } } return new ContinuousQueryResult(type, key, value, p); }
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 ) ); }