Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #35873
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2016-10-27 23:51 -0700 |
| Message-ID | <d1c8beb2-3ef7-4965-afa0-4cb0902c02fb@googlegroups.com> (permalink) |
| Subject | Parameterized Factory with additional parameter requires new interface? |
| From | mike <mikaelpetterson@hotmail.com> |
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 — 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