-
Notifications
You must be signed in to change notification settings - Fork 125
MOBILE-35 Added LiteDeviceDelegatingViewResolver #12
Conversation
For the following JIRA: |
@Override | ||
protected void initServletContext(ServletContext servletContext) { | ||
String name = delegate.getClass().getName(); | ||
getApplicationContext().getAutowireCapableBeanFactory().initializeBean(delegate, name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should autowiring be done considering that the delegate was configured as an instance? That instance may have been (should have been) initialized already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err. no. that is an artifact of starting down one direction and changing course of the design.
I've added my comments. |
One more potential simplification to consider is to remove the usePrefix/useSuffix boolean properties and rely on whether a specific prefix or suffix is provided or not (i.e. is not |
The reason I established the default prefix and suffix is to simply the configuration, since you wouldn't have to specify it if you used the defaults. But as you suggest, you still have to specify one of the booleans, and its less clear how it is configured when using the defaults. Probably best to expect explicitly set prefix and suffix values and key off those. I was thinking ahead a bit about an alternate implementation, and what contracts these implementations should share. Having the interface/abstract class was part of that thought process. |
Agree. Keeping consistent with the existing prefix and suffix approaches would be good. Regarding abstract classes, I would say that the parent is AbstractDelegatingViewResolver which has an abstract protected method for assembling the view name, which is called from resolveViewName. Also, do you need setViewResolver(delegate) given that it is required and is set on the constructor. I'd prefer it was immutable. |
Indeed, I've already dropped the interface and moved the getDeviceViewName to a protected abstract method. As you say, we don't need the setViewResolver method either, now that I'm removing the interface. |
I've made several improvements and adjustments based on discussions and feedback. I still need to polish the javadoc and update tests, but here's what I have so far. |
I've rebased in copyright date updates and moved the device and sitepreference code out of the abstract class. |
No description provided.