You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Henning Schmiedehausen (JIRA)" <ji...@apache.org> on 2006/11/05 19:43:19 UTC
[jira] Updated: (VELOCITY-102) Add Support for Static Utility
Classes
[ http://issues.apache.org/jira/browse/VELOCITY-102?page=all ]
Henning Schmiedehausen updated VELOCITY-102:
--------------------------------------------
Bugzilla Id: (was: 11924)
Component/s: Engine
(was: Source)
Fix Version/s: 1.6
Assignee: (was: Velocity-Dev List)
Shouldn't be too hard to implement. I like the StaticWrapper idea. Schedule it for 1.6
> Add Support for Static Utility Classes
> --------------------------------------
>
> Key: VELOCITY-102
> URL: http://issues.apache.org/jira/browse/VELOCITY-102
> Project: Velocity
> Issue Type: Improvement
> Components: Engine
> Affects Versions: 1.3-rc1
> Environment: Operating System: All
> Platform: All
> Reporter: Juozas Baliuka
> Priority: Minor
> Fix For: 1.6
>
>
> Support for Static Utility Classes is:
> 1) define namespaces
>
> context.defineNamespace("Math").add( java.lang.Math.class ) ;
> used as $Math.sin(0)
> 2) Add / Replace / remove methods in namespace :
> context.getNamespace("Math").add(MyRandom.class.getMethod("randomString",new
> Class[]{int.class}))
> used as $Math.randomString(12)
> 3) "union" on namespaces
> context.defineNamespace("Utils")
> .add(context.getNamespace("Math"))
> .add(context.defineNamespace("Collections",Collections.class ) );
> used as:
> $Utils.sin(0)
> $Utils.sort($list)
> 4) Global namespace
> context.getGlobalNamespace().add( Math.class );
> used as $sin(0)
> 5) inline namespaces:
> #use java.lang.Math as Math
> $Math.sin(0)
> #end
> #with Math
> $sin(0)
> #end
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org