public ShortProtofieldAccessor(int fieldNumber, String name, boolean nullable, String columnName) { super( fieldNumber, name, nullable, columnName, (ProtoStreamWriter outProtobuf, Short value) -> outProtobuf.writeInt( name, value ), (ProtoStreamReader reader) -> { Integer readInt = reader.readInt( name ); if ( readInt != null ) { int truncated = Math.min( Math.max( readInt, Short.MIN_VALUE ), Short.MAX_VALUE ); if ( truncated != readInt ) { throw LOG.truncatingShortOnRead( readInt, name ); } return (short) truncated; } return null; } ); }
public ByteProtofieldAccessor(int tag, String name, boolean nullable, String columnName) { super( tag, name, nullable, columnName, (ProtoStreamWriter outProtobuf, Byte value) -> outProtobuf.writeInt( name, value ), (ProtoStreamReader reader) -> { Integer storedValue = reader.readInt( name ); return ( storedValue == null ) ? null : storedValue.byteValue(); } ); }
writer.writeInt(name, (Integer) value);
writer.writeInt(name, (Integer) value);
@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, User user) throws IOException { writer.writeInt("id", user.getId()); writer.writeCollection("accountIds", user.getAccountIds(), Integer.class); writer.writeString("name", user.getName()); writer.writeString("surname", user.getSurname()); writer.writeString("salutation", user.getSalutation()); writer.writeCollection("addresses", user.getAddresses(), Address.class); writer.writeInt("age", user.getAge()); writer.writeEnum("gender", user.getGender()); writer.writeString("notes", user.getNotes()); writer.writeInstant("creationDate", user.getCreationDate()); writer.writeInstant("passwordExpirationDate", user.getPasswordExpirationDate()); }
@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()); } }
@Override public void writeTo(ProtoStreamWriter writer, EntityInterface obj) throws IOException { writer.writeInt("id", obj.getId()); writer.writeString("fieldValue", obj.getFieldValue()); }
@Override public void writeTo(ProtoStreamWriter writer, Account account) throws IOException { writer.writeInt("id", account.getId()); writer.writeString("description", account.getDescription()); writer.writeDate("creationDate", account.getCreationDate()); writer.writeObject("limits", account.getLimits(), Account.Limits.class); writer.writeObject("hardLimits", account.getHardLimits(), Account.Limits.class); writer.writeCollection("blurb", account.getBlurb(), byte[].class); writer.writeArray("currencies", account.getCurrencies(), Account.Currency.class); } }
@Override public void writeTo(ProtoStreamWriter writer, Address address) throws IOException { writer.writeString("street", address.getStreet()); writer.writeString("postCode", address.getPostCode()); writer.writeInt("number", address.getNumber()); writer.writeBoolean("isCommercial", address.isCommercial()); } }
@Override public void writeTo(ProtoStreamWriter writer, DynamicEntity1 obj) throws IOException { writer.writeInt("seed", obj.seed); writer.writeString("value", obj.value); }
@Override public void writeTo(ProtoStreamWriter writer, EntityInterface obj) throws IOException { writer.writeInt("id", obj.getId()); writer.writeString("fieldValue", obj.getFieldValue()); }
@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, DynamicEntity1 obj) throws IOException { writer.writeInt("seed", obj.seed); writer.writeString("value", obj.value); }
@Override public void writeTo(ProtoStreamWriter writer, DynamicEntity2 obj) throws IOException { writer.writeString("theType", obj.theType); writer.writeInt("rank", obj.rank); }
@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); }
@Override public void writeTo(ProtoStreamWriter writer, DynamicEntity2 obj) throws IOException { writer.writeString("theType", obj.theType); writer.writeInt("rank", obj.rank); }
public IntegerProtofieldAccessor(int fieldNumber, String name, boolean nullable, String columnName) { super( fieldNumber, name, nullable, columnName, (ProtoStreamWriter outProtobuf, Integer value) -> outProtobuf.writeInt( name, value ), (ProtoStreamReader reader) -> reader.readInt( name ) ); }