/** Notifies ElementByteSizeObserver about the byte size of the encoded value using this coder. */ @Override public void registerByteSizeObserver( RawUnionValue union, ElementByteSizeObserver observer, Context context) throws Exception { int index = getIndexForEncoding(union); // Write out the union tag. observer.update(VarInt.getLength(index)); // Write out the actual value. @SuppressWarnings("unchecked") Coder<Object> coder = (Coder<Object>) elementCoders.get(index); coder.registerByteSizeObserver(union.getValue(), observer, context); }