Required and Optional Arguments

6 views
Skip to first unread message

wat3r...@gmail.com

unread,
Nov 5, 2015, 11:10:15 AM11/5/15
to rythmengine
Hi All,

Is there any way to specify that an argument is required or optional? I've been reading the documentation. But, I have not found the answer. Also, I tried the hello world example in the tutorial. It appears that arguments are treated as all optional. If there's no value, then it won't render anything. I'd like to throw an exception when a required argument does not have a value. Any ideas?

Thanks,
Maria

green

unread,
Nov 5, 2015, 5:37:57 PM11/5/15
to rythmengine
All arguments are optional. If you failed to specify the argument, the default value will be passed into the template. Default value means, for all object instance, it is null, for primitive types they are:
"int" -> "0"
"long"->, "0L"
"short"-> "0"
"byte"-> "0"
"float"-> "0f"
"double"-> "0d"
"char"-> "(char)0"
"boolean"-> "false"

--
You received this message because you are subscribed to the Google Groups "rythmengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rythmengine...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

green

unread,
Nov 5, 2015, 5:39:05 PM11/5/15
to rythmengine
Actually for primitive types (e.g. int) and their wrapper types (e.g. Integer), their default value all follow the following mapping rules:
"int" -> "0"
"long"->, "0L"
"short"-> "0"
"byte"-> "0"
"float"-> "0f"
"double"-> "0d"
"char"-> "(char)0"
"boolean"-> "false"

wat3r...@gmail.com

unread,
Nov 12, 2015, 11:58:53 AM11/12/15
to rythmengine
Thanks, this is helpful. I appreciate it.
Reply all
Reply to author
Forward
0 new messages