You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-user@jakarta.apache.org by "Mark R. Diggory" <md...@latte.harvard.edu> on 2003/01/17 22:35:36 UTC

Which version of regexp is suggested.

I'm using ant to retrieve the dependencies for my project which is using 
bcel, is there a "recommended version" of regexp that you are currently 
using? If its available from http://www.ibiblio.org/maven/regexp/jars/ 
I'll grab it there.

-Thanks,
Mark



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT - sort of] Primitives hurt!

Posted by Juozas Baliuka <ba...@centras.lt>.
paste code from this page, it handles arrays too:
http://cglib.sourceforge.net/xref/net/sf/cglib/ReflectUtils.html#124

> I'm stuck at an issue that maybe someone on the list can help
>
>
> The nice thing about the Type class is that I can hand it a "Class"
> object and get back the appropriate type.
>
> public static getType(Class cls)...
>
> I need to keep generic-ness in my application (which is a small BCEL
> taglibrary for Jelly to manipulate Beans). This means I have something
like
>
> *
> <bcel:property name="foo" type="java.lang.String" ...>
> *
>
> so I'm passing around String representations of Classes to methods like
>
> *
> public void addProperty(String name, String type,...){
>
> Type propType = Type.getType(Class.forName(type));
> ...
> *
>
> which works great for regular Classes, unfortunately it doesn't work for
>   primitive types. Calls like:
>
> *
> Class.forName("int")
> *
>
> just don't work, which is frustrating because for the reciprical case:
>
> *
> java.lang.Object.class.toString() returns "java.lang.Object"
> java.lang.Object.getClass().getName() returns "java.lang.Object"
> Class.forName("java.lang.Object").toString() returns "java.lang.Object"
> *
>
> while
>
> *
> int.class.toString() returns "int"
> int.getClass().getName() returns "int"
> *
>
> but
>
> *
> Class.forName("int").toString()
> *
>
> fails with a ClassNotFoundException.
>
> This is something that sucks about primitive type names in the Java API.
> My question, is there a simple way in BCEL to get around this issue, I
> could require the type parameter of my method to require a signature,
> but that is hard for users (who don't know what they are) to use my
> tools, I'd rather be able to just capture the Class object for any
> String representation of a primitive type ("int", "double", "byte" ...)
> and do it simply and elegantly.
>
> Thanks for any comments,
> Mark
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[OT - sort of] Primitives hurt!

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
I'm stuck at an issue that maybe someone on the list can help


The nice thing about the Type class is that I can hand it a "Class" 
object and get back the appropriate type.

public static getType(Class cls)...

I need to keep generic-ness in my application (which is a small BCEL 
taglibrary for Jelly to manipulate Beans). This means I have something like

*
<bcel:property name="foo" type="java.lang.String" ...>
*

so I'm passing around String representations of Classes to methods like

*
public void addProperty(String name, String type,...){

	Type propType = Type.getType(Class.forName(type));
	...
*

which works great for regular Classes, unfortunately it doesn't work for 
  primitive types. Calls like:

*
Class.forName("int")
*

just don't work, which is frustrating because for the reciprical case:

*
java.lang.Object.class.toString() returns "java.lang.Object"
java.lang.Object.getClass().getName() returns "java.lang.Object"
Class.forName("java.lang.Object").toString() returns "java.lang.Object"
*

while

*
int.class.toString() returns "int"
int.getClass().getName() returns "int"
*

but

*
Class.forName("int").toString()
*

fails with a ClassNotFoundException.

This is something that sucks about primitive type names in the Java API. 
My question, is there a simple way in BCEL to get around this issue, I 
could require the type parameter of my method to require a signature, 
but that is hard for users (who don't know what they are) to use my 
tools, I'd rather be able to just capture the Class object for any 
String representation of a primitive type ("int", "double", "byte" ...) 
and do it simply and elegantly.

Thanks for any comments,
Mark


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>