List of usage examples for org.springframework.beans.factory ObjectFactory getObject
T getObject() throws BeansException;
From source file:org.openregistry.core.web.resources.PeopleResourceUtils.java
public static ReconciliationCriteria buildReconciliationCriteriaFrom(final PersonRequestRepresentation request, final ObjectFactory<ReconciliationCriteria> factory, final ReferenceRepository referenceRepository) { final ReconciliationCriteria rc = factory.getObject(); rc.getSorPerson().setSourceSor(request.systemOfRecordId); rc.getSorPerson().setSorId(request.systemOfRecordPersonId); for (final PersonRequestRepresentation.Name requestName : request.names) { final SorName name = rc.getSorPerson().addName(); updateName(name, requestName, referenceRepository); }//from w w w. jav a 2s . c o m rc.getSorPerson().setDateOfBirth(request.dateOfBirth); rc.getSorPerson().setSsn(request.ssn); rc.getSorPerson().setGender(request.gender); if (request.reconciliation != null) { if (request.reconciliation.address != null) { rc.setAddressLine1(request.reconciliation.address.addressLine1); rc.setAddressLine2(request.reconciliation.address.addressLine2); rc.setCity(request.reconciliation.address.city); rc.setRegion(request.reconciliation.address.region); rc.setPostalCode(request.reconciliation.address.postalCode); } if (!request.reconciliation.emails.isEmpty()) { rc.setEmailAddress(request.reconciliation.emails.get(0).email); } if (!request.reconciliation.phones.isEmpty()) { updatePhone(rc, request.reconciliation.phones.get(0).phoneNumber); } if (!request.reconciliation.identifiers.isEmpty()) { for (final PersonRequestRepresentation.Reconciliation.Identifier identifier : request.reconciliation.identifiers) { final IdentifierType identifierType = referenceRepository .findIdentifierType(identifier.identifierType); Assert.notNull(identifierType); rc.getIdentifiersByType().put(identifierType, identifier.identifierValue); } } } return rc; }
From source file:org.rosenvold.spring.convention.ConventionBeanFactory.java
/** * Resolve the given autowiring value against the given required type, * e.g. an {@link org.springframework.beans.factory.ObjectFactory} value to its actual object result. * * @param autowiringValue the value to resolve * @param requiredType the type to assign the result to * @return the resolved value/*from w w w. java 2s. c o m*/ */ public static Object resolveAutowiringValue(Object autowiringValue, Class requiredType) { if (autowiringValue instanceof ObjectFactory && !requiredType.isInstance(autowiringValue)) { ObjectFactory factory = (ObjectFactory) autowiringValue; if (autowiringValue instanceof Serializable && requiredType.isInterface()) { autowiringValue = Proxy.newProxyInstance(requiredType.getClassLoader(), new Class[] { requiredType }, new ObjectFactoryDelegatingInvocationHandler(factory)); } else { return factory.getObject(); } } return autowiringValue; }
From source file:org.ocelotds.spring.ClientScope.java
@Override public Object get(String string, ObjectFactory<?> of) { return of.getObject(); }
From source file:net.beachchou.spring.ioc.CustomScope.java
@Override public Object get(String string, ObjectFactory<?> of) { i++;//from w w w . j a v a 2 s . co m o = of.getObject(); if (i % 2 == 0) { return of.getObject(); } else { return o; } }
From source file:org.vaadin.spring.internal.BeanStore.java
protected Object create(String s, ObjectFactory<?> objectFactory) { final Object bean = objectFactory.getObject(); if (!(bean instanceof Serializable)) { LOGGER.warn("Storing non-serializable bean [{}] with name [{}]", bean, s); }//from w w w.j a v a2s . c o m return bean; }
From source file:org.jboss.spring.cluster.CacheScope.java
public Object get(String name, ObjectFactory objectFactory) { Object result = get(name);//from ww w .ja v a 2 s . co m return (result != null) ? result : put(name, objectFactory.getObject()); }
From source file:com.sunkur.springjavafxcontroller.scope.ScreenScope.java
@Override public Object get(String name, ObjectFactory<?> objectFactory) { if (!screens.containsKey(name)) { screens.put(name, (BaseScreenController) objectFactory.getObject()); }/*w ww .ja va 2 s. c o m*/ return screens.get(name); }
From source file:com.vaadin.spring.internal.BeanStore.java
protected Object create(String s, ObjectFactory<?> objectFactory) { final Object bean = objectFactory.getObject(); if (!(bean instanceof Serializable)) { LOGGER.warn("Storing non-serializable bean [{}] with name [{}] in [{}]", bean, s, this); }/*from w w w . ja va 2s . com*/ return bean; }
From source file:org.suren.autotest.web.framework.spring.AutotestScope.java
@Override public Object get(String name, ObjectFactory<?> objectFactory) { Object object = objMap.get(name); if (object == null) { object = objectFactory.getObject(); objMap.put(name, object);/*from ww w. j a v a 2 s . c o m*/ } return object; }
From source file:com.fusesource.forge.jmstest.tests.simple.SimpleProducer.java
protected void run() { ObjectFactory factory = (ObjectFactory) getApplicationContext().getBean("AsyncProducerFactory"); for (int i = 0; i < NUM_PRODUCERS; i++) { AsyncProducer producer = (AsyncProducer) factory.getObject(); producer.setMsgGroup("MsgGroup-" + i); producer.start();//from w w w . j a v a 2s . co m } }