commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedikt Ritter (Updated) (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SANDBOX-363) Check if value is of the correct type in Argument.argument( Class<T> type, V value )
Date Sun, 22 Jan 2012 12:31:44 GMT

     [ https://issues.apache.org/jira/browse/SANDBOX-363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Benedikt Ritter updated SANDBOX-363:
------------------------------------

    Comment: was deleted

(was: Ciao Simo,

here are a few thoughts about your comment on SANDBOX-363:


I should have looked at TypeUtils before creating a patch, sorry for 
that! Never the less, I don't understand, why Boolean.class works, where 
as Boolean.TYPE will cause the type check to fail. I'll dig into that later.


You're absolutely right. I wanted to wrap all of that into one method. 
But I guess we should go with one check for the array reference itself 
and one for every reference contained. Looking at guava's Preconditions, 
it seems to me, that they iterate over a collection and call 
checkElementIndex for every element. I really don't want to see a 
validation loop inside our methods. Instead I would wrap that loop 
inside an additional check method. What are you're thoughts about that?


I'm not sure if I agree with you on that topic. As Robert C. Martin 
wrote in Clean Code, a method's name should make explicit, what the 
method is doing. I would argue, that all the methods annotated with 
@Test run a test on a specific method. So they should be called 
testWhatEverMethodName(). I agree with you, that it is a bit redundant. 
So, if you say, that you want to get rid of those test prefixes, I will 
fix that, when I work on SANDBOX-362.


I'm so sorry, that my patch again had the wrong format. I'm a bit 
embarrassed about that. I have applied the code style to my eclipse 
installation now. Future patches will have the correct format.

It takes some time to get your IDE configured right for contributing. I 
thought about writing a guide for the apache wiki on how to configure a 
bare eclipse installation to get started. What do you think?

I will fix all the things you mentioned ASAP.

Buona giornata!
Benedikt

(to be honest, I don't know any italian. But I try my best, googling 
those phrases, because you always know some german words ;-)


)
    
> Check if value is of the correct type in Argument.argument( Class<T> type, V value
)
> ------------------------------------------------------------------------------------
>
>                 Key: SANDBOX-363
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-363
>             Project: Commons Sandbox
>          Issue Type: Improvement
>          Components: BeanUtils2
>    Affects Versions: Nightly Builds
>            Reporter: Benedikt Ritter
>            Priority: Minor
>         Attachments: SANDBOX-363.txt
>
>
> Although the compiler should check that value is always of the correct type, a programmatic
check should back this up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message