Example usage for org.springframework.beans.factory ObjectFactory getObject

List of usage examples for org.springframework.beans.factory ObjectFactory getObject

Introduction

In this page you can find the example usage for org.springframework.beans.factory ObjectFactory getObject.

Prototype

T getObject() throws BeansException;

Source Link

Document

Return an instance (possibly shared or independent) of the object managed by this factory.

Usage

From source file:com.mycompany.CRMFly.AdditionalFeatures.ViewScope.java

public Object get(String name, ObjectFactory objectFactory) {
    Map<String, Object> viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap();

    if (viewMap.containsKey(name)) {
        return viewMap.get(name);
    } else {/*from   w ww  .  ja  v  a 2 s  .  c  o  m*/
        Object object = objectFactory.getObject();
        viewMap.put(name, object);

        return object;
    }
}

From source file:uk.ac.ebi.intact.editor.util.FlashScope.java

public Object get(String name, ObjectFactory objectFactory) {

    Flash flash = FacesContext.getCurrentInstance().getExternalContext().getFlash();

    Object obj;//from w  ww .  ja v  a 2 s.com

    if (flash.containsKey(name)) {
        obj = flash.get(name);
    } else {
        obj = objectFactory.getObject();
        flash.put(name, obj);
    }

    return obj;
}

From source file:com.amazonaws.services.simpleworkflow.flow.spring.WorkflowScope.java

@Override
public Object get(String name, ObjectFactory<?> objectFactory) {
    Map<String, Object> map = objects.get();
    Object result = map.get(name);
    if (result == null) {
        result = objectFactory.getObject();
        map.put(name, result);/*from ww  w.j  a  v  a 2  s  . c o  m*/
    }
    return result;
}

From source file:be.kdg.repaircafe.scopes.ViewScope.java

@Override
public Object get(String name, ObjectFactory objectFactory) {
    Map<String, Object> viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap();

    if (viewMap.containsKey(name)) {
        return viewMap.get(name);
    } else {//from   ww  w . ja  va2 s .  c o m
        Object object = objectFactory.getObject();
        viewMap.put(name, object);

        return object;
    }
}

From source file:com.siriusit.spezg.multilib.jsf.platform.ViewScope.java

@Override
public Object get(String name, ObjectFactory<?> objectFactory) {
    Map<String, Object> viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap();
    if (viewMap.containsKey(name)) {
        return viewMap.get(name);
    } else {/*from w w  w  .  j a  v  a  2 s .  co m*/
        Object object = objectFactory.getObject();
        viewMap.put(name, object);

        return object;
    }
}

From source file:org.geppetto.core.scope.ThreadScope.java

/**
  * Gets bean from scope./*from   w  w  w  .  j  a  v  a  2s . c o m*/
  */
public Object get(String name, ObjectFactory<?> factory) {
    Object result = null;

    Map<String, Object> hBeans = ThreadScopeContextHolder.currentThreadScopeAttributes().getBeanMap();

    if (!hBeans.containsKey(name)) {
        result = factory.getObject();

        hBeans.put(name, result);
    } else {
        result = hBeans.get(name);
    }

    return result;
}

From source file:org.molasdin.wbase.jsf.spring.scope.JsfFlowScope.java

@Override
public Object get(String s, ObjectFactory<?> objectFactory) {
    Map<Object, Object> scope = flowScope();
    if (scope == null) {
        return null;
    }/*  ww w .  j  a  v  a2  s.c  om*/

    if (scope.containsKey(s)) {
        return scope.get(s);
    }

    Object o = objectFactory.getObject();
    scope.put(s, o);
    return o;
}

From source file:uk.ac.ebi.intact.editor.util.ViewScope.java

public Object get(String name, ObjectFactory objectFactory) {

    Map<String, Object> viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap();

    Object obj;//from   w  w w  . j  a  va 2s .  c  om

    if (viewMap.containsKey(name)) {
        obj = viewMap.get(name);
    } else {
        obj = objectFactory.getObject();
        viewMap.put(name, obj);
    }

    return obj;
}

From source file:net.sourceforge.jabm.spring.SimulationScope.java

@Override
public Object get(String name, ObjectFactory<?> objectFactory) {
    if (logger.isDebugEnabled())
        logger.debug("Looking up bean " + name);
    Object result = boundObjects.get(name);
    if (result == null) {
        result = objectFactory.getObject();
        boundObjects.put(name, result);//from   w  ww. j a  v  a  2s .c  o m
    }
    if (logger.isDebugEnabled()) {
        logger.debug("Returning " + result + " with hash " + result.hashCode() + " for " + name);
    }
    return result;
}

From source file:net.sourceforge.jabm.gametheory.GameTheoreticSimulationController.java

public void initialise() {
    strategies = new ArrayList<Strategy>(strategyInitialisers.size());
    for (StrategyInitialiser init : strategyInitialisers) {
        ObjectFactory<Strategy> factory = init.getStrategyFactory();
        strategies.add(factory.getObject());
    }//  ww  w  .j a va 2s . com
    int numAgents = getPopulation().getAgents().size();
    payoffMatrix = new CompressedPayoffMatrix(strategies, numAgents);
}