class RegisterTypeFactory {

  public RegisterTypeCommand create(final RegisterType statement) {
    final String name = statement.getName();
    final boolean ifNotExists = statement.getIfNotExists();
    final SqlType type = statement.getType().getSqlType();

    if (!ifNotExists && metaStore.resolveType(name).isPresent()) {
      throw new KsqlException(
          "Cannot register custom type '" + name + "' "
              + "since it is already registered with type: " + metaStore.resolveType(name).get()
      );
    }

    return new RegisterTypeCommand(type, name);
  }

    RegisterTypeFactory(final MetaStore metaStore);

}