Exemple #1
0
    @Override
    public void write(Kryo kryo, Output output) {
      output.writeInt(objectID, true);

      int methodClassID = kryo.getRegistration(method.getDeclaringClass()).getId();
      output.writeInt(methodClassID, true);

      CachedMethod[] cachedMethods = getMethods(kryo, method.getDeclaringClass());
      CachedMethod cachedMethod = null;
      for (int i = 0, n = cachedMethods.length; i < n; i++) {
        cachedMethod = cachedMethods[i];
        if (cachedMethod.method.equals(method)) {
          output.writeByte(i);
          break;
        }
      }

      for (int i = 0, n = cachedMethod.serializers.length; i < n; i++) {
        Serializer serializer = cachedMethod.serializers[i];
        if (serializer != null) {
          kryo.writeObjectOrNull(output, args[i], serializer);
        } else {
          kryo.writeClassAndObject(output, args[i]);
        }
      }

      output.writeByte(responseID);
    }
 @Override
 public void write(Kryo kryo, Output output) {
   output.writeString(this.firstname);
   output.writeString(this.lastname);
   kryo.writeObjectOrNull(output, this.emailAddress, SerializableEmailAddress.class);
   output.writeInt(this.addresses.size());
   for (Address address : this.addresses) {
     kryo.writeObject(output, address);
   }
 }