private synchronized <ParametersT extends Parameters> Key createKeyTyped(
      ParametersT parameters, @Nullable Integer idRequirement) throws GeneralSecurityException {
    Class<?> parametersClass = parameters.getClass();
    KeyCreator<?> creator = creators.get(parametersClass);
    if (creator == null) {
      throw new GeneralSecurityException(
          "Cannot create a new key for parameters "
              + parameters
              + ": no key creator for this class was registered.");
    }
    @SuppressWarnings("unchecked") // We know we only insert like this.
    KeyCreator<ParametersT> castCreator = (KeyCreator<ParametersT>) creator;
    return castCreator.createKey(parameters, idRequirement);
  }
Creates a {@link Key} from a given {@link Parameters} object.

<p>Finds the previously added creator (with {@link #add}) for the class given by {@code
parameters.getClass()} and uses it.
java_src/src/main/java/com/google/crypto/tink/internal/MutableKeyCreationRegistry.java