X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=support%2Fspring%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Ftest%2Fspring%2FTestSpringBeanFactory.java;h=2c2fc2a7c2f274e1ce7c9231216933b98af10e38;hb=17775e14ecfb286e59f67117e5cee7e21e95ab1f;hp=d604e166d598e330d3bf95af93f7d27f5ef0d391;hpb=0d8d8f24656e585ee75558cfd6a4c661f8f14985;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 d604e166..2c2fc2a7 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. @@ -16,48 +16,60 @@ 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; /** - * 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) { + assert obj != null; + + return aClass.cast(obj); + } catch (BeansException e) { throw new BeanFactoryException(e.getMessage(), e); } } - }