Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #35874
| From | j4n bur53 <janburse@fastmail.fm> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Parameterized Factory with additional parameter requires new interface? |
| Date | 2016-10-28 10:27 +0200 |
| Organization | albasani.net |
| Message-ID | <nuv24q$bpd$1@news.albasani.net> (permalink) |
| References | <d1c8beb2-3ef7-4965-afa0-4cb0902c02fb@googlegroups.com> |
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