Search in sources :

Example 6 with Address

use of org.infinispan.protostream.sampledomain.Address in project protostream by infinispan.

the class UserMarshaller method readFrom.

@Override
public User readFrom(ProtoStreamReader reader) throws IOException {
    int id = reader.readInt("id");
    Set<Integer> accountIds = reader.readCollection("accountIds", new HashSet<>(), Integer.class);
    String name = reader.readString("name");
    String surname = reader.readString("surname");
    String salutation = reader.readString("salutation");
    List<Address> addresses = reader.readCollection("addresses", new ArrayList<>(), Address.class);
    Integer age = reader.readInt("age");
    User.Gender gender = reader.readEnum("gender", User.Gender.class);
    String notes = reader.readString("notes");
    Instant creationDate = reader.readInstant("creationDate");
    Instant passwordExpirationDate = reader.readInstant("passwordExpirationDate");
    User user = new User();
    user.setId(id);
    user.setAccountIds(accountIds);
    user.setName(name);
    user.setSurname(surname);
    user.setSalutation(salutation);
    user.setAge(age);
    user.setGender(gender);
    user.setAddresses(addresses);
    user.setNotes(notes);
    user.setCreationDate(creationDate);
    user.setPasswordExpirationDate(passwordExpirationDate);
    return user;
}
Also used : User(org.infinispan.protostream.sampledomain.User) Address(org.infinispan.protostream.sampledomain.Address) Instant(java.time.Instant)

Aggregations

Address (org.infinispan.protostream.sampledomain.Address)6 User (org.infinispan.protostream.sampledomain.User)5 Instant (java.time.Instant)1 SerializationContext (org.infinispan.protostream.SerializationContext)1 QueryFactory (org.infinispan.query.dsl.QueryFactory)1 Test (org.junit.Test)1