<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-2"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Akkor nincs szükséged a fluent API-s bohóckodásra sem?<div><br></div><div><br></div><div><a href="http://stackoverflow.com/questions/362424/accessing-constructor-of-an-anonymous-class">http://stackoverflow.com/questions/362424/accessing-constructor-of-an-anonymous-class</a></div><div><div class="post-text"><p>You can have a constructor in the abstract 
class that accepts the init parameters. The Java spec only specifies 
that the anonymous class, which is the offspring of the (optionally) 
abstract class or implementation of an interface, can not have a 
constructor by her own right.</p><p>The following is absolutely legal and possible:</p>

<pre class="lang-java prettyprint prettyprinted"><code><span class="kwd">static</span><span class="pln"> </span><span class="kwd">abstract</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> Q</span><span class="pun">{</span><span class="pln">
    </span><span class="kwd">int</span><span class="pln"> z</span><span class="pun">;</span><span class="pln">
    Q</span><span class="pun">(</span><span class="kwd">int</span><span class="pln"> z</span><span class="pun">){</span><span class="pln"> </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">z</span><span class="pun">=</span><span class="pln">z</span><span class="pun">;}</span><span class="pln">
    </span><span class="kwd">void</span><span class="pln"> h</span><span class="pun">(){</span><span class="pln">
        Q me </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> Q</span><span class="pun">(</span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        </span><span class="pun">};</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></code></pre><p>If you have the possibility to write the abstract class yourself, put
 such a constructor there and use fluent API where there is no better 
solution.</p></div></div><div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; border-spacing: 0px; "><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; "><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 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></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br><div><div>On 2013.01.31., at 13:34, &lt;<a href="mailto:istvan.ketler@lhsystems.com">istvan.ketler@lhsystems.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta content="text/html; charset=utf-8" http-equiv="Content-Type">

<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<div>
<div>
<font style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Mert a vilagon semmi ertelme nem lenne anonymust a deklaracio helyen lehet peldanyositani ott meg meg a befogado metodus lokal valtozoit is latja (ha final).
<br>
Sent from my cellular</font><br>
&nbsp;<br>
</div>
<div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">&nbsp;</p><div style="margin: 0cm 0cm 0pt; "><span style="FONT-SIZE: 8pt; COLOR: gray; FONT-FAMILY: Arial">Sitz der Gesellschaft / Corporate Headquarters: </span><span lang="EN-GB" style="FONT-SIZE: 8pt; COLOR: gray; FONT-FAMILY: Arial; mso-ansi-language: EN-GB">Lufthansa Systems Hungaria Kft, Budapest, Fovarosi Birosag 01-09-463417<br></span><span style="FONT-SIZE: 8pt; COLOR: gray; FONT-FAMILY: Arial">Geschaeftsfuehrung / Management Board: Peter Sipos</span></div><div style="margin: 0cm 0cm 0pt; "><br></div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"></p><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<font style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"><b>From</b>: Peter Verhas [mailto:peter@<a href="http://verhas.com">verhas.com</a>]
<br>
<b>Sent</b>: Thursday, January 31, 2013 01:20 PM<br>
<b>To</b>: Java lista &lt;<a href="mailto:javalist@lists.javaforum.hu">javalist@lists.javaforum.hu</a>&gt; <br>
<b>Subject</b>: Re: [Javalist] Hogyan kényszerítsünk egy anonymous classt bizonyos dolgok megadására
<br>
</font>&nbsp;<br>
</div>
Miért nem lehet konstruktor paramétere az anonymous osztálynak?
<div><br>
</div>
<div><span style="color: rgb(136, 136, 136); font-family: Helvetica; ">--</span></div>
<div>
<div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; border-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; 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; border-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; 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; border-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="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 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>
</span></div></span></span></div></div></div></div></blockquote></div><br></div></body></html>