protected static void setupExternalContext() { if (container.getExternalContext() == null) { if (externalContext != null) { container.setExternalContext(externalContext); } } else if (container.getExternalContext().getApplication() == null && externalContext != null) { container.getExternalContext().setApplication(externalContext.getApplication()); } if (container.getExternalContextComponentDefRegister() == null && externalContextComponentDefRegister != null) { container.setExternalContextComponentDefRegister(externalContextComponentDefRegister); } }
public static LaContainerPreparer getPreparer(ComponentDef componentDef) { final LaContainer container = componentDef.getContainer(); final ComponentDef[] componentDefs = container.findLocalComponentDefs(LaContainerPreparer.class); if (componentDefs.length == 0) { return null; } return (LaContainerPreparer) componentDefs[0].getComponent(); }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") protected <COMPONENT> COMPONENT getComponent(String name) { // user method return (COMPONENT) SingletonLaContainer.getComponent(name); }
/** * @see org.lastaflute.di.core.ComponentDef#getComponent() */ public Object getComponent() { return getContainer().getRoot().getExternalContext().getRequestHeaderValuesMap(); } }
/** * @see org.lastaflute.di.core.ComponentDef#getComponent() */ public Object getComponent() { return getContainer().getRoot().getExternalContext().getRequestHeaderMap(); } }
@Override public Object getComponent() { return getContainer().getRoot().getExternalContext().getRequestMap(); } }
/** * @see org.lastaflute.di.core.ComponentDef#getComponent() */ public Object getComponent() { return getContainer().getRoot().getExternalContext().getRequest(); } }
/** * @see org.lastaflute.di.core.ComponentDef#getComponent() */ public Object getComponent() { return getContainer().getRoot().getExternalContext().getResponse(); } }
protected Object getComponent(ComponentDef componentDef, Object key, Object component, String propertyName) throws BeanIllegalPropertyException { try { return componentDef.getContainer().getComponent(key); } catch (RuntimeException cause) { throwPropertyComponentGetFailureException(componentDef, key, component, propertyName, cause); return null; // unreachable } }
protected boolean isInternalDebug() { if (internalDebug == null) { synchronized (ScriptingExpression.class) { if (internalDebug == null) { // almost no cost but cache just in case internalDebug = LastaDiProperties.getInstance().isInternalDebug(); } } } return internalDebug; } }
/** * @see org.lastaflute.di.core.meta.ArgDef#setChildComponentDef(org.lastaflute.di.core.ComponentDef) */ public final void setChildComponentDef(ComponentDef componentDef) { if (container != null) { componentDef.setContainer(container); } childComponentDef = componentDef; }
public static synchronized void destroy() { defaultBuilder = null; provider = null; if (configurationContainer != null) { configurationContainer.destroy(); } configurationContainer = null; initialized = false; }
public static LastaDiProperties getInstance() { if (instance == null) { synchronized (LastaDiProperties.class) { if (instance == null) { instance = new LastaDiProperties(); } } } return instance; }
/** {@inheritDoc} */ protected boolean hasComponent(Class<?> type) { // user method try { SingletonLaContainer.getComponent(type); return true; } catch (ComponentNotFoundException ignored) { return false; } }
/** * @param componentType The component type to find. (NotNull) * @return The found component. (NotNull) * @throws ComponentNotFoundException When the component is not found by the type. * @throws TooManyRegistrationComponentException When the component key is related to plural components. * @throws CyclicReferenceComponentException When the components refers each other. */ public static <COMPONENT> COMPONENT getComponent(Class<COMPONENT> componentType) { // most frequently used return (COMPONENT) SingletonLaContainer.getComponent(componentType); }
/** * @param componentName The component name to find. (NotNull) * @return The found component. (NotNull) * @throws ComponentNotFoundException When the component is not found by the type. * @throws TooManyRegistrationComponentException When the component key is related to plural components. * @throws CyclicReferenceComponentException When the components refers each other. */ public static <COMPONENT> COMPONENT pickupComponentByName(String componentName) { final COMPONENT component = SingletonLaContainer.getComponent(componentName); // variable for generic return component; }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") protected <COMPONENT> COMPONENT getComponent(String name) { // user method return (COMPONENT) SingletonLaContainer.getComponent(name); }
/** {@inheritDoc} */ protected boolean hasComponent(String name) { // user method try { SingletonLaContainer.getComponent(name); return true; } catch (ComponentNotFoundException ignored) { return false; } }
/** {@inheritDoc} */ protected boolean hasComponent(String name) { // user method try { SingletonLaContainer.getComponent(name); return true; } catch (ComponentNotFoundException ignored) { return false; } }
/** * @param componentType The component type to find. (NotNull) * @return The found component. (NotNull) * @throws ComponentNotFoundException When the component is not found by the type. * @throws TooManyRegistrationComponentException When the component key is related to plural components. * @throws CyclicReferenceComponentException When the components refers each other. */ public static <COMPONENT> COMPONENT getComponent(Class<COMPONENT> componentType) { // most frequently used return (COMPONENT) SingletonLaContainer.getComponent(componentType); }