Spring Framework ObjectFactory - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework ObjectFactory class.

This code example shows how to use the following methods:getObject
This code example shows how to use the following methods:getObject
 
	@Override 
	public Object get(String name, ObjectFactory<?> objectFactory) {
		Object scopedObject = this.servletContext.getAttribute(name);
		if (scopedObject == null) {
			scopedObject = objectFactory.getObject();
			this.servletContext.setAttribute(name, scopedObject);
		} 
		return scopedObject;
	} 
 
	@Override 
	public Object remove(String name) {
		Object scopedObject = this.servletContext.getAttribute(name);
		if (scopedObject != null) {
			this.servletContext.removeAttribute(name);
			this.destructionCallbacks.remove(name);
			return scopedObject;
		} 
		else { 
6
CodeRank
This code example shows how to use the following methods:getObject
			if (autowiringValue instanceof Serializable && requiredType.isInterface()) {
				autowiringValue = Proxy.newProxyInstance(requiredType.getClassLoader(),
						new Class<?>[] {requiredType}, new ObjectFactoryDelegatingInvocationHandler(factory));
			} 
			else { 
				return factory.getObject();
			} 
		} 
		return autowiringValue;
	} 
 
	/** 
	 * Determine the target type for the generic return type of the given 
	 * <em>generic factory method</em>, where formal type variables are declared 
	 * on the given method itself. 
	 * <p>For example, given a factory method with the following signature, 
	 * if {@code resolveReturnTypeForFactoryMethod()} is invoked with the reflected 
	 * method for {@code creatProxy()} and an {@code Object[]} array containing 
	 * {@code MyService.class}, {@code resolveReturnTypeForFactoryMethod()} will 
	 * infer that the target return type is {@code MyService}. 
5
CodeRank
See Code Examples for Spring Framework ObjectFactory Methods: