« Return to Thread: [jira] Created: (LANG-508) Validate: add message parameter construction via elllipsis notation to speed up processing

[jira] Commented: (LANG-508) Validate: add message parameter construction via elllipsis notation to speed up processing

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View in Thread


    [ https://issues.apache.org/jira/browse/LANG-508?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725486#action_12725486 ]

Henri Yandell commented on LANG-508:
------------------------------------

I'm uncomfortable with dropping the String message from the API.

notNull(Object, String, Object...) however seems fine.

I'm also wondering if there's any reason to keep notNull(Object, Object...) as a general API, or if messages should be mandatory.

> Validate: add message parameter construction via elllipsis notation to speed up processing
> ------------------------------------------------------------------------------------------
>
>                 Key: LANG-508
>                 URL: https://issues.apache.org/jira/browse/LANG-508
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.4
>            Reporter: Mark Struberg
>             Fix For: 3.0
>
>         Attachments: LANG-508.patch
>
>
> Currently passing verbose message strings to a log of commons.lang.Validate functions costs a lot of performance.
> A typical usecase currently is:
> {noformat}
> Validate.isTrue (argInt1.intValue > argInt2.intValue, "param2 actually is " + argInt2 + " but must larger than param1 " + argInt1 +" !");
> {noformat}
> So all the string operations get executed regardless if the validation fails or not.
> This can be made perform much better by moving all the string operations inside the respective validation function and execute it only if the validation fails:
> {noformat}
> Validate.isTrue(argInt1.intValue > argInt2.intValue, "param2 actually is {1} but must larger than param1 {0} !", argInt1, argInt2);
> {noformat}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

 « Return to Thread: [jira] Created: (LANG-508) Validate: add message parameter construction via elllipsis notation to speed up processing