// Path: src/main/java/com/cathive/fx/guice/fxml/FXMLLoadingModule.java
// public final class FXMLLoadingModule extends AbstractModule {
// 
//     public FXMLLoadingModule() {
//         super();
//     }
// 
//     @Override
//     protected void configure() {
// 
//         // FXMLLoadingScope
//         final FXMLLoadingScope fxmlLoadingScope = new FXMLLoadingScope();
//         bind(FXMLLoadingScope.class).toInstance(fxmlLoadingScope);
//         bindScope(FXMLController.class, fxmlLoadingScope);
//         bindScope(FXMLComponent.class, fxmlLoadingScope);
// 
//         // GuiceFXMLLoader
//         bind(GuiceFXMLLoader.class);
// 
//         // FXMLControllerTypeListener
//         final FXMLControllerTypeListener fxmlControllerTypeListener = new FXMLControllerTypeListener();
//         requestInjection(fxmlControllerTypeListener);
//         bind(FXMLControllerTypeListener.class).toInstance(fxmlControllerTypeListener);
//         bindListener(Matchers.any(), fxmlControllerTypeListener);
// 
//         // FXMLComponentTypeListener
//         final FXMLComponentTypeListener fxmlComponentTypeListener = new FXMLComponentTypeListener();
//         requestInjection(fxmlComponentTypeListener);
//         bind(FXMLComponentTypeListener.class).toInstance(fxmlComponentTypeListener);
//         bindListener(Matchers.any(), fxmlComponentTypeListener);
// 
//         // ControllerLookup
//         bind(ControllerLookup.class).toProvider(new ControllerLookupProvider(fxmlLoadingScope));
// 
//     }
// 
// 
//     private final class ControllerLookupProvider implements Provider<ControllerLookup> {
//         private final FXMLLoadingScope fxmlLoadingScope;
//         private ControllerLookupProvider(final FXMLLoadingScope fxmlLoadingScope) {
//             super();
//             this.fxmlLoadingScope = fxmlLoadingScope;
//         }
//         @Override
//         public ControllerLookup get() {
//             if (!fxmlLoadingScope.isActive()) {
//                 throw new IllegalStateException("A ControllerLookup instance cannot be injected while outside of the FXML Loading scope.");
//             }
//             return new ControllerLookup(fxmlLoadingScope.getIdentifiables());
//         }
//     }
// 
// }
// 
// Path: src/main/java/com/cathive/fx/guice/prefs/PersistentPropertyModule.java
// public final class PersistentPropertyModule extends AbstractModule {
// 
//     @Override
//     public void configure() {
//         bindListener(Matchers.any(), new PersistentPropertyTypeListener());
//     }
// 
// }
// 
// Path: src/main/java/com/cathive/fx/guice/thread/FxApplicationThreadModule.java
// public final class FxApplicationThreadModule extends AbstractModule {
// 
//     @Override
//     protected void configure() {
//         bindInterceptor(
//                 Matchers.any(),
//                 Matchers.annotatedWith(FxApplicationThread.class), 
//                 new FxApplicationThreadMethodInterceptor());
//     }
// 
// }


import com.google.inject.Module;
import java.lang.annotation.Annotation;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor;
import java.util.*;
import com.google.inject.Provider;
import javafx.application.Application;
import com.cathive.fx.guice.fxml.FXMLLoadingModule;
import com.cathive.fx.guice.prefs.PersistentPropertyModule;
import com.cathive.fx.guice.thread.FxApplicationThreadModule;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
     * during the invocation of this overriden method: {@link #init(java.util.List)}.</p>
     */
    @Override
    public final void init() throws Exception {

        super.init();

        @SuppressWarnings("unchecked")
        final Class<GuiceApplication> clazz = (Class<GuiceApplication>) getClass();
        final GuiceApplication instance = this;

        // Checks the GuiceApplication instance and makes sure that none of the constructors is
        // annotated with @Inject!
        for (final Constructor<?> c: instance.getClass().getConstructors()) {
            if (isInjectAnnotationPresent(c)) {
                throw new IllegalStateException("GuiceApplication with constructor that is marked with @Inject is not allowed!");
            }
        }

        final Set<Module> modules = new HashSet<>();
        modules.add(new AbstractModule() {
            @Override
            protected void configure() {
				bind(clazz).toProvider(new Provider<GuiceApplication>() {
					@Override public GuiceApplication get() {
						return instance;
					}
				});
            }
        });
// Path: src/main/java/com/cathive/fx/guice/fxml/FXMLLoadingModule.java
// public final class FXMLLoadingModule extends AbstractModule {
// 
//     public FXMLLoadingModule() {
//         super();
//     }
// 
//     @Override
//     protected void configure() {
// 
//         // FXMLLoadingScope
//         final FXMLLoadingScope fxmlLoadingScope = new FXMLLoadingScope();
//         bind(FXMLLoadingScope.class).toInstance(fxmlLoadingScope);
//         bindScope(FXMLController.class, fxmlLoadingScope);
//         bindScope(FXMLComponent.class, fxmlLoadingScope);
// 
//         // GuiceFXMLLoader
//         bind(GuiceFXMLLoader.class);
// 
//         // FXMLControllerTypeListener
//         final FXMLControllerTypeListener fxmlControllerTypeListener = new FXMLControllerTypeListener();
//         requestInjection(fxmlControllerTypeListener);
//         bind(FXMLControllerTypeListener.class).toInstance(fxmlControllerTypeListener);
//         bindListener(Matchers.any(), fxmlControllerTypeListener);
// 
//         // FXMLComponentTypeListener
//         final FXMLComponentTypeListener fxmlComponentTypeListener = new FXMLComponentTypeListener();
//         requestInjection(fxmlComponentTypeListener);
//         bind(FXMLComponentTypeListener.class).toInstance(fxmlComponentTypeListener);
//         bindListener(Matchers.any(), fxmlComponentTypeListener);
// 
//         // ControllerLookup
//         bind(ControllerLookup.class).toProvider(new ControllerLookupProvider(fxmlLoadingScope));
// 
//     }
// 
// 
//     private final class ControllerLookupProvider implements Provider<ControllerLookup> {
//         private final FXMLLoadingScope fxmlLoadingScope;
//         private ControllerLookupProvider(final FXMLLoadingScope fxmlLoadingScope) {
//             super();
//             this.fxmlLoadingScope = fxmlLoadingScope;
//         }
//         @Override
//         public ControllerLookup get() {
//             if (!fxmlLoadingScope.isActive()) {
//                 throw new IllegalStateException("A ControllerLookup instance cannot be injected while outside of the FXML Loading scope.");
//             }
//             return new ControllerLookup(fxmlLoadingScope.getIdentifiables());
//         }
//     }
// 
// }
// 
// Path: src/main/java/com/cathive/fx/guice/prefs/PersistentPropertyModule.java
// public final class PersistentPropertyModule extends AbstractModule {
// 
//     @Override
//     public void configure() {
//         bindListener(Matchers.any(), new PersistentPropertyTypeListener());
//     }
// 
// }
// 
// Path: src/main/java/com/cathive/fx/guice/thread/FxApplicationThreadModule.java
// public final class FxApplicationThreadModule extends AbstractModule {
// 
//     @Override
//     protected void configure() {
//         bindInterceptor(
//                 Matchers.any(),
//                 Matchers.annotatedWith(FxApplicationThread.class), 
//                 new FxApplicationThreadMethodInterceptor());
//     }
// 
// }


// Path: src/main/java/com/cathive/fx/guice/GuiceApplication.java
import com.google.inject.Module;
import java.lang.annotation.Annotation;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor;
import java.util.*;
import com.google.inject.Provider;
import javafx.application.Application;
import com.cathive.fx.guice.fxml.FXMLLoadingModule;
import com.cathive.fx.guice.prefs.PersistentPropertyModule;
import com.cathive.fx.guice.thread.FxApplicationThreadModule;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;

     * during the invocation of this overriden method: {@link #init(java.util.List)}.</p>
     */
    @Override
    public final void init() throws Exception {

        super.init();

        @SuppressWarnings("unchecked")
        final Class<GuiceApplication> clazz = (Class<GuiceApplication>) getClass();
        final GuiceApplication instance = this;

        // Checks the GuiceApplication instance and makes sure that none of the constructors is
        // annotated with @Inject!
        for (final Constructor<?> c: instance.getClass().getConstructors()) {
            if (isInjectAnnotationPresent(c)) {
                throw new IllegalStateException("GuiceApplication with constructor that is marked with @Inject is not allowed!");
            }
        }

        final Set<Module> modules = new HashSet<>();
        modules.add(new AbstractModule() {
            @Override
            protected void configure() {
				bind(clazz).toProvider(new Provider<GuiceApplication>() {
					@Override public GuiceApplication get() {
						return instance;
					}
				});
            }
        });
        modules.add(new FXMLLoadingModule());