public void register(BasicType type) {
    if (locked) {
      throw new HibernateException("Can not alter TypeRegistry at this time");
    }

    if (type == null) {
      throw new HibernateException("Type to register cannot be null");
    }

    if (type.getRegistrationKeys() == null || type.getRegistrationKeys().length == 0) {
      LOG.typeDefinedNoRegistrationKeys(type);
    }

    for (String key : type.getRegistrationKeys()) {
      // be safe...
      if (key == null) continue;
      LOG.debugf("Adding type registration %s -> %s", key, type);
      final Type old = registry.put(key, type);
      if (old != null && old != type) LOG.typeRegistrationOverridesPrevious(key, old);
    }
  }