@CanIgnoreReturnValue
    public <SerializationT extends Serialization> Builder registerKeyParser(
        KeyParser<SerializationT> parser) throws GeneralSecurityException {
      ParserIndex index =
          new ParserIndex(parser.getSerializationClass(), parser.getObjectIdentifier());
      if (keyParserMap.containsKey(index)) {
        KeyParser<?> existingParser = keyParserMap.get(index);
        if (!existingParser.equals(parser) || !parser.equals(existingParser)) {
          throw new GeneralSecurityException(
              "Attempt to register non-equal parser for already existing object of type: " + index);
        }
      } else {
        keyParserMap.put(index, parser);
      }
      return this;
    }
Registers a key parser for later use in {@link #parseKey}.

<p>This registers a key serializer which can later be used to serialize a key by calling
{@link #parseKey}. If a parser for the pair {@code (SerializationT,
parser.getObjectIdentifier())} has already been registered, this checks if they are the same.
If they are, the call is ignored, otherwise an exception is thrown.
java_src/src/main/java/com/google/crypto/tink/internal/SerializationRegistry.java