Ensure method A is called after every call of B (an abstract implemented method)?
<p>Having this tasteful class </p>

<pre><code>     public abstract class CakeSkill 
     {

         //.. 

         boolean cherry=false;

         private void finalMandatoryTouch()
         {        
              cherry=true;
         }                
         abstract public void cook();
     }
</code></pre>

<p>A class that extends it would be something like</p>

<pre><code>     class Cheff extends CakeSkill 
     {
         //..

         void cook()
         {
         //..Secret recipe
         }     
     }
</code></pre>

<p>But of course this won't work, </p>

<p><em>finalMandaroryTouch()</em> hasn't been called, then <strong>no cake will end with a cherry..</strong></p>

<p><strong>[EDIT]</strong></p>

<p>This one <em>could</em> be a solution </p>

<pre><code>       class MemoriousCheff extends CakeSkill 
       {
           //..

           void cook()
           {
               //..Secret recipe
               finalMandatoryTouch();
           }     
       }
</code></pre>

<p><em>but</em> requires :</p>

<ul>
<li>Cheff to have a perfect memory that don't forget to call finalMandatoryTouch()</li>
<li>Making finalMandatoryTouch() to be <em>protected</em> (at least)</li>
</ul>

<p><strong>[/EDIT]</strong></p>

<p>It would be great! (but no Java) if something like this could be done</p>

<pre><code>  abstract public void cook()   
  {  
    @implementedMethod

    finalMandatoryTouch();        
  }
</code></pre>

<p>How can be implemented this useful functionality ?</p>

<p>Thank you very much</p>
