<html>
<head>
<meta content="text/html; charset=ISO-8859-2"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
1) Szerintem nem. Max. runtime ellenőrzést tudsz végezni, és dobni
egy kivételt. Mondjuk talán azzal, hogy ha A altípusa B-nek, akkor
Class<A> nem altípusa Class<B>-nek lehet valamit
játszani, de ez ugyanúgy kizárja azt, ha interface-ből származtatsz
pl. másik interfészt.<br>
<br>
2) Első blikkre:<br>
<br>
public <T extends FactoryManaged> void
create(Class<T> interfAce,<br>
Class<? extends T> klass);<br>
<br>
Ricsi<br>
<br>
On 2012.06.08. 11:41, Peter Verhas wrote:
<blockquote
cite="mid:8EBEE5DD-E130-49FB-AC58-7D35E2950BD2@verhas.com"
type="cite">
<div><br>
</div>
<div>Van egy factory osztály, amelyik létrehoz és visszaad
objektumot. </div>
<div><br>
</div>
<div>
<div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom:
0px; margin-left: 0px; font: normal normal normal
11px/normal Monaco; color: rgb(150, 26, 101); ">public<span
style="color: rgb(0, 0, 0); "> </span>interface<span
style="color: rgb(0, 0, 0); "> Factory {</span></div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom:
0px; margin-left: 0px; font: normal normal normal
11px/normal Monaco; min-height: 15px; "> <span
style="color: rgb(150, 26, 101); ">public</span> <span
style="color: rgb(150, 26, 101); ">void</span> create(Class<? <span
style="color: rgb(150, 26, 101); ">extends</span> FactoryManaged>
interfAce,</div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom:
0px; margin-left: 0px; font: normal normal normal
11px/normal Monaco; "> Class<? <span
style="color: rgb(150, 26, 101); ">extends</span> FactoryManaged>
klass);</div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom:
0px; margin-left: 0px; font: normal normal normal
11px/normal Monaco; min-height: 15px; "> <span
style="color: rgb(150, 26, 101); ">public</span> FactoryManaged
get(Class<? <span style="color: rgb(150, 26, 101); ">extends</span> FactoryManaged>
klass);</div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom:
0px; margin-left: 0px; font: normal normal normal
11px/normal Monaco; min-height: 15px; ">}</div>
</div>
</div>
<div><br>
</div>
<div>Hogyan tudnám azt generics-szel leírni, hogy az interfAce ne
lehessen osztály, abstract osztály, csak interface? Le lehet-e
valahogy írni generics-szel, hogy klass csak olyan osztály lehet
ami implementálja az interfAce interfészt?</div>
<div><br>
</div>
<br>
<div>
<span class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: Helvetica; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-align: auto; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width:
0px; font-size: medium; "><span class="Apple-style-span"
style="border-collapse: separate; color: rgb(0, 0, 0);
font-family: Helvetica; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal;
line-height: normal; orphans: 2; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; -webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width:
0px; font-size: medium; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space; "><span
class="Apple-style-span" style="border-collapse:
separate; color: rgb(0, 0, 0); font-family: Helvetica;
font-style: normal; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: normal;
orphans: 2; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; font-size: medium; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode:
space; -webkit-line-break: after-white-space; ">
<div><span class="Apple-style-span" style="color:
rgb(136, 136, 136); ">--</span><span
class="Apple-style-span" style="color: rgb(136,
136, 136); "><br>
</span><span class="Apple-style-span" style="color:
rgb(136, 136, 136); ">Verhás Péter</span><span
class="Apple-style-span" style="color: rgb(136,
136, 136); "><br>
</span><span class="Apple-style-span" style="color:
rgb(136, 136, 136); "></span><span
class="Apple-style-span" style="color: rgb(136,
136, 136); "><a moz-do-not-send="true"
href="mailto:peter@verhas.com">peter@verhas.com</a></span><span
class="Apple-style-span" style="color: rgb(136,
136, 136); "><br>
</span><span class="Apple-style-span" style="color:
rgb(136, 136, 136); ">+36(30)9306805</span><span
class="Apple-style-span" style="color: rgb(136,
136, 136); "><br>
</span><span class="Apple-style-span" style="color:
rgb(136, 136, 136); ">skype: verhas</span></div>
</div>
</span><br class="Apple-interchange-newline">
</div>
</span><br class="Apple-interchange-newline">
</span><br class="Apple-interchange-newline">
</div>
<div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom:
0px; margin-left: 0px; font: normal normal normal 11px/normal
Monaco; color: rgb(150, 26, 101); "><br>
</div>
</div>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Javalist mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Javalist@lists.javaforum.hu">Javalist@lists.javaforum.hu</a>
<a class="moz-txt-link-freetext" href="http://lists.javaforum.hu/mailman/listinfo/javalist">http://lists.javaforum.hu/mailman/listinfo/javalist</a>
</pre>
</blockquote>
</body>
</html>