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

com.github.bordertech.lde.mojo.CrossStateUtil Maven / Gradle / Ivy

The newest version!
package com.github.bordertech.lde.mojo;

import com.github.bordertech.lde.api.LdeProvider;
import java.util.HashMap;
import java.util.Map;

/**
 * Save LDE Provider across Maven Lifecycle States.
 */
public final class CrossStateUtil {

	private static final Map PROVIDERS = new HashMap<>();

	/**
	 * Private constructor.
	 */
	private CrossStateUtil() {
	}

	/**
	 * Retrieve the provider for this id.
	 *
	 * @param id the provider id
	 * @return the provider for this id or null if does not exist
	 */
	public static LdeProvider getProvider(final String id) {
		return PROVIDERS.get(id);
	}

	/**
	 * Save the provider for this id.
	 *
	 * @param id the provider id
	 * @param provider the provider to save
	 */
	public static void addProvider(final String id, final LdeProvider provider) {
		PROVIDERS.put(id, provider);
	}

	/**
	 * Remove the provider for this id.
	 *
	 * @param id the provider id to remove
	 * @return the provider for this id or null if does not exist
	 */
	public static LdeProvider removeProvider(final String id) {
		return PROVIDERS.remove(id);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy