private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); Type<E> type = SerializationContext.getType(entityClass); EntityProxy<E> proxy = type.proxyProvider().apply(entity); for (Property<E, ?> property : proxy.filterProperties(getPropertyFilter())) { Object value = property.get(); stream.writeObject(value); } }