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

net.sf.mmm.crypto.random.AbstractSecurityGetRandomFactory Maven / Gradle / Ivy

The newest version!
package net.sf.mmm.crypto.random;

/**
 * Abstract interface to {@link #getRandomFactory() get} the {@link RandomFactory}.
 *
 * @author Joerg Hohwiller (hohwille at users.sourceforge.net)
 * @since 1.0.0
 */
public abstract interface AbstractSecurityGetRandomFactory {

  /**
   * @return the {@link RandomFactory}. May be {@code null}.
   */
  RandomFactory getRandomFactory();

  /**
   * @throws IllegalStateException if {@link #getRandomFactory()} is {@code null}.
   * @return the {@link RandomFactory}. Never {@code null}.
   */
  default RandomFactory getRandomFactoryRequired() {

    RandomFactory factory = getRandomFactory();
    if (factory == null) {
      throw new IllegalStateException("RandomFactory is not available!");
    }
    return factory;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy