In org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaDataFactory I 
have a method (convertToJavaClass) that does the name to array class 
conversion.  Here is the core:

int arraySize = 0;
while(name.endsWith("[]")) {
    name = name.substring(0, name.length()-2);
    arraySize++;
}

try {
    // get the base class
    Class c = entity.getClassLoader().loadClass(name);

    // if we have an array get the array class
    if(arraySize > 0) {
       int[] dimensions = new int[arraySize];
       for(int i=0; i<arraySize; i++) {
          dimensions[i]=1;
       }
       c = Array.newInstance(c, dimensions).getClass();
    }

    return c;
} catch(ClassNotFoundException e) {
    throw new DeploymentException("Parameter class not found: " + name);
}

It that what he wanted to do?

-dain

Hiram Chirino wrote:

> Question for you classloading feaks out there, what is the difference 
> between:
> 
> x = "some.class.name";
> Thread.currentThread().getContextClassLoader().loadClass(x);
> 
> and
> 
> x = "some.class.name";
> Class.forName(x, false,
>     Thread.currentThread().getContextClassLoader());
> 
> Peter Levart, submitted a patch that replaces a statment like the first 
> with a statment like the seconds.   It's supposed to allow "loading
> array class for a base class that hasn't been loaded yet."
> 
> My thing is, it seems like they do the same thing.  What's the difference?
> 
> Regards,
> Hiram
> 
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
> 
> 
> _______________________________________________________________
> 
> Have big pipes? SourceForge.net is looking for download mirrors. We supply
> the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-development



_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to