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

com.jwebmp.guicedinjection.interfaces.IGuicePreDestroy Maven / Gradle / Ivy

Go to download

Guice Injection allows you to access multiple Guice Binders and Modules across separate archives. Allowing you to configure your applications with injection from multiple dependancies. Servlets, EJB's, and Stand-Alone is supported. Requires JDK 8 or 10.

The newest version!
/*
 * Copyright (C) 2017 GedMarc
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */
package com.jwebmp.guicedinjection.interfaces;

import java.util.Comparator;

/**
 * Initializes before Guice has been injected
 *
 * @author GedMarc
 * @since 15 May 2017
 */
public interface IGuicePreDestroy>
		extends Comparator, Comparable
{

	/**
	 * Runs on startup
	 */
	void onDestroy();

	@Override
	default int compare(J o1, J o2)
	{
		return o1.sortOrder()
		         .compareTo(o2.sortOrder());
	}


	/**
	 * Sort order for startup, Default 100.
	 *
	 * @return the sort order never null
	 */
	default Integer sortOrder()
	{
		return 100;
	}

	@Override
	default int compareTo(J o)
	{
		if (o == null)
		{
			return -1;
		}
		int result = sortOrder().compareTo(o.sortOrder());
		if (getClass().equals(o.getClass()))
		{
			return 0;
		}
		return result == 0 ? 1 : result;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy