All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.molgenis.data.transaction.TransactionExceptionTranslatorRegistry Maven / Gradle / Ivy

There is a newer version: 8.4.5
Show newest version
package org.molgenis.data.transaction;

import com.google.common.collect.Sets;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import org.springframework.stereotype.Component;

/** Registry of {@link TransactionExceptionTranslator TransactionExceptionTranslators} */
@Component
public class TransactionExceptionTranslatorRegistry {
  private final Set transactionExceptionTranslators;

  public TransactionExceptionTranslatorRegistry() {
    transactionExceptionTranslators = Sets.newLinkedHashSetWithExpectedSize(1);
  }

  public Collection getTransactionExceptionTranslators() {
    return Collections.unmodifiableSet(transactionExceptionTranslators);
  }

  public void register(TransactionExceptionTranslator transactionExceptionTranslator) {
    transactionExceptionTranslators.add(transactionExceptionTranslator);
  }

  @SuppressWarnings("unused")
  public void unregister(TransactionExceptionTranslator transactionExceptionTranslator) {
    transactionExceptionTranslators.remove(transactionExceptionTranslator);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy