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

org.kurator.akka.Contract Maven / Gradle / Ivy

Go to download

Provenance-enabled workflow platform and toolkit to curate biodiversity data.

The newest version!
package org.kurator.akka;

/** 
 * 

This file is an adaptation of Contract.java in the org.restlow.util * package as of 16Sep2015. See licenses/restflow_license.txt for * the copyright notice, license, and git repository URL for RestFlow.

*/ public abstract class Contract { private static boolean enforceContract; static { synchronized(Contract.class) { enforceContract = false; } } public static void enforceContract(boolean value) { synchronized(Contract.class) { enforceContract = value; } } public static void requires(Object state, Object... allowedStates) { synchronized(Contract.class) { if (enforceContract) { for (Object allowed : allowedStates) { if (state == allowed) return; } throw new IllegalStateException("State: " + state); } } } public static void disallows(Object state, Object... disallowedStates) { synchronized(Contract.class) { if (enforceContract) { for (Object disallowed : disallowedStates) { if (state == disallowed) { throw new IllegalStateException("State: " + state); } } } } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy