You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Richard Bibb <ri...@aimhedge.com> on 2009/08/24 15:05:59 UTC

Overloading Mappers

Does iBatis 3.0 allow for overloaded mapper definitions? e.g

public interface egMapper {
	ArrayList<DataSet> exampleMapper(SomeClass args);
	ArrayList<DataSet> exampleMapper(AnotherClass args);
}

Obviously the XML file is going to need to understand the difference...
-- 
View this message in context: http://www.nabble.com/Overloading-Mappers-tp25115777p25115777.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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


Re: Overloading Mappers

Posted by Richard Bibb <ri...@aimhedge.com>.
Advice taken 8-O

Thanks Clinton


Clinton Begin wrote:
> 
> No!  :-)
> 
> Outside of iBATIS, I've always recommended avoiding method overloading (ad
> hoc polymorphism).  It's just a bad practice.  The method is likely doing
> something different, so give it a good name.
> 
> On rare occasions it makes some sense, like say before Object wrappers,
> having .valueOf() overloaded for each of the primitives was okay (but
> still
> a design flaw due to Java's primitive types).
> 
> But most DAO methods aren't like that.  They do something specific, so the
> name should reflect that.
> 
> Clinton
> 
> 

-- 
View this message in context: http://www.nabble.com/Overloading-Mappers-tp25115777p25116887.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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


Re: Overloading Mappers

Posted by Clinton Begin <cl...@gmail.com>.
No!  :-)

Outside of iBATIS, I've always recommended avoiding method overloading (ad
hoc polymorphism).  It's just a bad practice.  The method is likely doing
something different, so give it a good name.

On rare occasions it makes some sense, like say before Object wrappers,
having .valueOf() overloaded for each of the primitives was okay (but still
a design flaw due to Java's primitive types).

But most DAO methods aren't like that.  They do something specific, so the
name should reflect that.

Clinton

On Mon, Aug 24, 2009 at 7:05 AM, Richard Bibb <ri...@aimhedge.com>wrote:

>
> Does iBatis 3.0 allow for overloaded mapper definitions? e.g
>
> public interface egMapper {
>        ArrayList<DataSet> exampleMapper(SomeClass args);
>        ArrayList<DataSet> exampleMapper(AnotherClass args);
> }
>
> Obviously the XML file is going to need to understand the difference...
> --
> View this message in context:
> http://www.nabble.com/Overloading-Mappers-tp25115777p25115777.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>