https://bz.apache.org/bugzilla/show_bug.cgi?id=67080

--- Comment #16 from Anurag Dubey <anura...@amazon.com> ---
(In reply to Christopher Schultz from comment #14)
> The fromLookupAndSwitch technique seems to be implemented in an awkward way.
> Why bother converting from String -> Enum and then using a switch on the
> enum, instead of just (a) implementing a getScopeNumber() method in each
> enum instance or (b) just using convenient ordinal values which match the
> value you actually want?
> 
> I would think this would be the best implementation if you wanted to use
> Enums:
> 
> enum Scope {
>     applicationScope(0), cookie(1), header(2), ...
> 
>   public static int fromLookupAndSwitch(String scope) {
>     Scope scope = lookupMap.get(scope);
>     if(null == scope) {
>     } else {
>       return scope.ordinal();
>     }
>   }
> }
> 
> I understand that this test is no longer "from lookup and switch" but I
> decided to keep the method name the same.
> 
> I guess the point is if you use a hash, you don't have to use a switch at
> all.

That is to mimic the outer switch which anyways applies in the getValue method.
ref-
https://github.com/anuragdy/tomcat/blob/4257836d0930c853f862dfe5f0aad4c24cefec31/java/javax/servlet/jsp/el/ImplicitObjectELResolver.java#L90

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to