Search in sources :

Example 6 with Component

use of com.developmentontheedge.be5.api.Component in project be5 by DevelopmentOnTheEdge.

the class Be5Injector method getComponent.

/**
 * Returns a created component.
 */
@Override
public Component getComponent(String componentId) {
    try {
        Class<?> klass = getComponentClass(componentId);
        Component component = (Component) klass.newInstance();
        configureIfConfigurable(component, configurations);
        injectAnnotatedFields(component);
        return component;
    } catch (InstantiationException | IllegalAccessException | ClassCastException e) {
        throw Be5Exception.internal(e, "Can't create component");
    }
}
Also used : Component(com.developmentontheedge.be5.api.Component)

Aggregations

Component (com.developmentontheedge.be5.api.Component)3 Be5ProjectTest (com.developmentontheedge.be5.test.Be5ProjectTest)3 Test (org.junit.Test)3 Response (com.developmentontheedge.be5.api.Response)2 Action (com.developmentontheedge.be5.model.Action)2 Request (com.developmentontheedge.be5.api.Request)1 Be5Exception (com.developmentontheedge.be5.api.exceptions.Be5Exception)1 UserHelper (com.developmentontheedge.be5.api.helpers.UserHelper)1 RequestImpl (com.developmentontheedge.be5.api.impl.RequestImpl)1 ResponseImpl (com.developmentontheedge.be5.api.impl.ResponseImpl)1 Matcher (java.util.regex.Matcher)1 ServletRequest (javax.servlet.ServletRequest)1 ServletResponse (javax.servlet.ServletResponse)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1