You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Shinobu Kawai <sh...@gmail.com> on 2004/11/06 14:04:09 UTC
Array #length and #clone() support.
Hi all,
I added array #length and #clone() support to the PublicFieldUberspect.
cf. http://localhost/java/langspec-2.0/arrays.doc.html#64347
This seems a good place for the #length support, but I'm not sure if
the #clone() support belongs to this class. (But I put it here
anyways. :))
If you set
runtime.introspector.uberspect =
org.apache.velocity.tools.generic.introspection.PublicFieldUberspect
in your velocity.properties, you can do the following:
$array -> int[] {1, 2, 3}
$array.length -> 3
#set($clone = $array.clone())
$clone -> int[] {1, 2, 3}, != $array
Any comments welcome.
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Array #length and #clone() support.
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi all,
> I added array #length and #clone() support to the PublicFieldUberspect.
> This seems a good place for the #length support, but I'm not sure if
> the #clone() support belongs to this class. (But I put it here
> anyways. :))
I moved the #clone() support to ArrayTool. Now, everything is in it's place.
http://wiki.apache.org/jakarta-velocity/ArrayTool
http://wiki.apache.org/jakarta-velocity/PublicFieldUberspect
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
Re: Array #length and #clone() support.
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi eric,
> Check java.lang.reflect.Array; it lets you get the length of any type
> of array (including primitives) without having to cast.
That's it! Thanks a whole bunch. :)
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
Re: Array #length and #clone() support.
Posted by Eric Fixler <fi...@fixler.com>.
Shinobu:
Check java.lang.reflect.Array; it lets you get the length of any type
of array (including primitives) without having to cast.
eric
>
---------------------------------------------------------------------
Eric Fixler
fix@fixler.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
Re: Array #length and #clone() support.
Posted by Shinobu Kawai <sh...@gmail.com>.
Why do I keep doing this?
The links I wanted to reference were:
http://wiki.apache.org/jakarta-velocity/PublicFieldUberspect
http://java.sun.com/docs/books/jls/second_edition/html/arrays.doc.html#64347
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
Re: Array #length and #clone() support.
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi all,
> I added array #length and #clone() support to the PublicFieldUberspect.
> This seems a good place for the #length support, but I'm not sure if
> the #clone() support belongs to this class. (But I put it here
> anyways. :))
I moved the #clone() support to ArrayTool. Now, everything is in it's place.
http://wiki.apache.org/jakarta-velocity/ArrayTool
http://wiki.apache.org/jakarta-velocity/PublicFieldUberspect
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Array #length and #clone() support.
Posted by Shinobu Kawai <sh...@gmail.com>.
Why do I keep doing this?
The links I wanted to reference were:
http://wiki.apache.org/jakarta-velocity/PublicFieldUberspect
http://java.sun.com/docs/books/jls/second_edition/html/arrays.doc.html#64347
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org