[ 
https://issues.apache.org/jira/browse/KI-81?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12717304#action_12717304
 ] 

Les Hazlewood commented on KI-81:
---------------------------------

To me, the 'fluff' interfaces _are_ the *Aware interfaces, and I wanted to get 
rid of them if possible.  But I don't know that we can.

I disagree with point 1) - if I call a method and the underlying implementation 
does not support it, it probably means I'm setting something that shouldn't be 
set for that particular configuration.  It would be misleading to allow that 
method call to continue, and I'd prefer a fail-fast scenario rather than 
letting it go on.

I don't think I like the idea of a Configuration object that is passed around, 
which would require a Service Locator type of pattern (i.e. "I'll pull what I 
need") instead of the Dependency Injection approach we have now ("Give me what 
I need").  The Configuration object approach might be useful if the underlying 
implementation was custom, but for almost all of these convenience passthrough 
methods, we're talking about Ki implementations - not a 3rd party.  I'm kinda 
on the fence about this - I think it could be good, but it sounds less 
desirable than the DI approach we're using now - and it could make our existing 
passthrough method implementations very ugly...

Now that I think about it, maybe the *Aware interfaces, although cumbersome, 
are necessary.  For example, I thought of a CookieAware interface that had 
things like setDomain, setPath, etc.  Well that doesn't work in the case of the 
WebSecurityManager, which needs to be able to configure 2 cookies - the 
rememberMe cookie passthrough attributes, and the sessionId cookie passthrough 
attributes.  Sure, the underlying RememberMeManager and SessionManager could 
implement a CookieAware interface, and maybe that's the happy medium.

> Passthrough configuration methods should probably be reflection-based
> ---------------------------------------------------------------------
>
>                 Key: KI-81
>                 URL: https://issues.apache.org/jira/browse/KI-81
>             Project: Ki
>          Issue Type: Improvement
>          Components: Configuration
>    Affects Versions: 0.9-RC1, 0.9
>            Reporter: Les Hazlewood
>             Fix For: 1.0
>
>
> We currently have a lot of methods to support passthrough configuration to 
> wrapped/delegate objects.  
> Most of the time, those passthrough methods are very specific to the 
> underlying wrapped implementation - we do a few 'instanceof' checks to see if 
> the underlying implementation is one of our default implementations or 
> interfaces, and if so, cast the object and then make the call.
> Instead, it might be nicer to just use reflection (or PropertyUtils) to take 
> the delegate object and reflectively call a setter method, without checking 
> for type first.  If the method call fails we could throw a nice message about 
> an unexpected type.
> This would allow us to get rid of a lot of 'fluff' interfaces that might 
> exist solely for passthrough configuration, which only add to bloat and often 
> confusion to those perusing the APIs.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to