Hello Laird,

The problem of having to cast the result of Context.lookup 
<http://download.java.net/java/jdk9/docs/api/javax/naming/Context.html#lookup-javax.naming.Name->
 can be solved using an existing method:
    InitialContext.doLookup 
<http://download.java.net/java/jdk9/docs/api/javax/naming/InitialContext.html#doLookup-javax.naming.Name->

Although it might not suit all uses because no JNDI environment properties are 
passed to the InitialContext
constructor that gets created within the method.



> On 13 Oct 2016, at 18:14, Laird Nelson <ljnel...@gmail.com> wrote:
> 
> Hello; I am new to this mailing list and its conventions; if I misstep I am
> happy to be pointed in the right direction.  I was directed here by Mark
> Reinhold.
> 
> Disclaimer in case it matters: I work for Oracle.
> 
> I have long wanted there to be methods in javax.naming.Context like the
> following:
> 
> // typed from memory off the cuff
> default <T> T lookup(final String name, final Class<T> type) {
>  return type.cast(this.lookup(name));
> }
> // do similar things for other lookup* methods here
> 
> What would be the steps I would next need to take to help with this?
> 
> Thanks in advance for help, time and guidance,
> Best,
> Laird
> --
> http://about.me/lairdnelson

Reply via email to