code: @Override
      public void validate(ByteBuffer bytes) throws MarshalException
      {
          ByteBuffer input = bytes.duplicate();
          for (int i = 0; i < size(); i++)
          {
              // we allow the input to have less fields than declared so as to support field addition.
              if (!input.hasRemaining())
                  return;
  
              if (input.remaining() < 4)
                  throw new MarshalException(String.format("Not enough bytes to read size of %dth field %s", i, fieldName(i)));
  
              int size = input.getInt();
  
              // size < 0 means null value
              if (size < 0)
                  continue;
  
              if (input.remaining() < size)
                  throw new MarshalException(String.format("Not enough bytes to read %dth field %s", i, fieldName(i)));
  
              ByteBuffer field = ByteBufferUtil.readBytes(input, size);
              types.get(i).validate(field);
          }
  
          // We're allowed to get less fields than declared, but not more
          if (input.hasRemaining())
              throw new MarshalException("Invalid remaining data after end of UDT value");
      }
docs: Note: the only reason we override this is to provide nicer error message, but since that's not that much code...