X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=support%2Fspring%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Ftest%2Fspring%2FTestSpringBeanFactory.java;h=0b2043eaf728659ef2424af06d26ac384ac2d202;hb=b576572516a19e5b9805bf623b0a11758631b34a;hp=a7cc6fe6b63dcf7f1e3cf14f8e08197091b01057;hpb=6baa1546bf990db7c66e9837bbb23f1070bf81e0;p=utils diff --git a/support/spring/src/test/java/org/wamblee/test/spring/TestSpringBeanFactory.java b/support/spring/src/test/java/org/wamblee/test/spring/TestSpringBeanFactory.java index a7cc6fe6..0b2043ea 100644 --- a/support/spring/src/test/java/org/wamblee/test/spring/TestSpringBeanFactory.java +++ b/support/spring/src/test/java/org/wamblee/test/spring/TestSpringBeanFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2005 the original author or authors. + * Copyright 2005-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,47 +17,57 @@ package org.wamblee.test.spring; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; -import org.wamblee.general.BeanFactory; -import org.wamblee.general.BeanFactoryException; +import org.wamblee.ioc.BeanFactory; +import org.wamblee.ioc.BeanFactoryException; /** - * Bean factory which uses Spring. - * + * Bean factory which uses Spring. + * * @author Erik Brakkee */ public class TestSpringBeanFactory implements BeanFactory { - - private ApplicationContext _context; - + private ApplicationContext context; + + /** + * Creates a new TestSpringBeanFactory object. + * + */ public TestSpringBeanFactory(ApplicationContext aContext) { - _context = aContext; + context = aContext; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.wamblee.general.BeanFactory#find(java.lang.String) */ public Object find(String aId) { - return find(aId, Object.class); + return find(aId, Object.class); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.wamblee.general.BeanFactory#find(java.lang.Class) */ public T find(Class aClass) { return find(aClass.getName(), aClass); } - /* (non-Javadoc) - * @see org.wamblee.general.BeanFactory#find(java.lang.String, java.lang.Class) + /* + * (non-Javadoc) + * + * @see org.wamblee.general.BeanFactory#find(java.lang.String, + * java.lang.Class) */ public T find(String aId, Class aClass) { try { - Object obj = _context.getBean(aId, aClass); - assert obj != null; - return aClass.cast(obj); - } catch (BeansException e) { + Object obj = context.getBean(aId, aClass); + assert obj != null; + + return aClass.cast(obj); + } catch (BeansException e) { throw new BeanFactoryException(e.getMessage(), e); } } - }