You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "White, Tim" <Ti...@qwest.com> on 2004/06/03 17:50:16 UTC

Overloading VelociMacros?

Hi -

 Is it possible to overload VelociMacros?

 e.g. :

 #macro (showIfExists $object $path $preNode $postNode $preList
$postList)
	#if($object.getMMCValue($path))
		$preList
		#foreach($nodeValue in $object.getMMCList($path))
			#if ($nodeValue.getValue("self::"))
				$preNode $nodeValue.getValue("self::")
$postNode
			#end
		#end
		$postList
	#end
#end

#macro (showIfExists $object $path $preNode $postNode)
	#showIfExists ($object $path $preNode $postNode "" "")
#end

I ask because VelociMacros can't have optional parameters. :)

I tried it and it seemed to take only the second one.  Just making sure
there's not a trick I'm missing... :)

Thanks!!!

Tim

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Overloading VelociMacros?

Posted by Mike Kienenberger <mk...@alaska.net>.
"White, Tim" <Ti...@qwest.com> wrote:
>  Is it possible to overload VelociMacros?
> I ask because VelociMacros can't have optional parameters. :)

I think it's generally done by passing a list or by passing "empty" 
arguments.

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org