Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #35874
| Path | csiph.com!news.mixmin.net!news.albasani.net!.POSTED!not-for-mail |
|---|---|
| From | j4n bur53 <janburse@fastmail.fm> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Parameterized Factory with additional parameter requires new interface? |
| Date | Fri, 28 Oct 2016 10:27:06 +0200 |
| Organization | albasani.net |
| Lines | 59 |
| Message-ID | <nuv24q$bpd$1@news.albasani.net> (permalink) |
| References | <d1c8beb2-3ef7-4965-afa0-4cb0902c02fb@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.albasani.net ceEnYM7TWRbZHHEdT0r+O9BL5TPw+qexbnKUUhImT90la7ZVAv5kBMNIn/OBi9/XgE/tWfEAupSO8pANsr1JCvo3efYIXsJ500HJaOR6RHX+v/PJQHu6M/EqmOwRxvWs |
| NNTP-Posting-Date | Fri, 28 Oct 2016 08:27:06 +0000 (UTC) |
| Injection-Info | news.albasani.net; logging-data="Nd3nFNje/EkmwX9zwj5igqlHEGtziUnYZB7oK62IndGkeUWKJ5QtMfysOTp/AgrIJBTKqo/3zoTSbchi9c0Z8s7JG5visrvptwYZesfGm5IHjbNbDmWpVseg8LXv26Hk"; mail-complaints-to="abuse@albasani.net" |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40 |
| In-Reply-To | <d1c8beb2-3ef7-4965-afa0-4cb0902c02fb@googlegroups.com> |
| Cancel-Lock | sha1:PMsD8c0NcSYdPgeaBbOWn4xnYrs= |
| Xref | csiph.com comp.lang.java.programmer:35874 |
Show key headers only | View raw
http://stackoverflow.com/questions/15200362/when-to-use-single-method-interfaces-in-java
mike schrieb:
> Hi,
>
> We have the following factory interface today:
>
> public interface Factory<T, R> {
>
> /**
> * Creates a new equipment type instance
> *
> * @param resource
> * @return equipment instance of type T
> */
> public T create(R data);
>
> }
>
>
> Now we need an additional create method that takes an additional parameter of type P.
>
>
> public interface Factory<T, R,P> {
>
> /**
> * Creates a new equipment type instance
> *
> * @param resource
> * @return equipment instance of type T
> */
> public T create(R resource);
>
> /**
> * Creates a new equipment type instance
> *
> * @param resource
> * @param parameter
> * @return equipment instance of type T
> */
> public T create(R resource,P parameter);
> }
>
>
> Then in the code I get:
>
> Incorrect number of arguments for type Factory<T,R,P>; it cannot be parameterized with arguments <XXXtype, XXXresource>
>
> Does this mean we have to create a new parameterized interface for each additional create() method that we have?
>
> If that is the case can you help me understand why?
>
> //mike
>
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Parameterized Factory with additional parameter requires new interface? mike <mikaelpetterson@hotmail.com> - 2016-10-27 23:51 -0700
Re: Parameterized Factory with additional parameter requires new interface? j4n bur53 <janburse@fastmail.fm> - 2016-10-28 10:27 +0200
Re: Parameterized Factory with additional parameter requires new interface? Andreas Leitgeb <avl@logic.at> - 2016-10-28 11:59 +0000
Re: Parameterized Factory with additional parameter requires new interface? Patrick Roemer <sangamon@netcologne.de> - 2016-10-28 15:17 +0200
Re: Parameterized Factory with additional parameter requires new interface? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-10-28 11:12 -0400
Re: Parameterized Factory with additional parameter requires new interface? j4n bur53 <janburse@fastmail.fm> - 2016-10-28 18:07 +0200
Re: Parameterized Factory with additional parameter requires new interface? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-10-28 16:43 -0400
csiph-web