package $javaPackage;

/**
 * Provides utility methods used in BaseFragment.
 */
@javax.annotation.Generated("org.cryptomator.generator.FragmentProcessor")
class $className {

    public static void inject(org.cryptomator.presentation.di.component.ActivityComponent component, org.cryptomator.presentation.ui.fragment.BaseFragment fragment) {
#foreach( $fragment in $fragments )
        if (fragment instanceof $fragment.qualifiedName) {
            component.inject(($fragment.qualifiedName)fragment);
        } else
#end
        {
            throw new java.lang.IllegalStateException("Failed to inject fragment of type " + fragment.getClass().getName());
        }
    }

    public static org.cryptomator.presentation.presenter.Presenter initializePresenter(org.cryptomator.presentation.ui.fragment.BaseFragment fragment) {
#foreach( $fragment in $fragments )
    if (fragment instanceof $fragment.qualifiedName) {
        #if ($fragment.hasPresenter)
            $fragment.qualifiedName castFragment = ($fragment.qualifiedName)fragment;
            ${fragment.presenterQualifiedName} presenter = castFragment.${fragment.presenterFieldName};
            return presenter;
        #else
            return null;
        #end
    } else
#end
        {
            throw new java.lang.IllegalStateException("Failed to initialize presenter for " + fragment.getClass().getName());
        }
    }

    private ${className}() {}

}
