Ecco la documentazione per il metodo protetto:perché non riesco ad accedere al metodo java protetto, anche se ho pensato di estendere la classe?
/** Converts jmusic score data into a MIDI Sequence */
protected javax.sound.midi.Sequence scoreToSeq(Score score)
e ho fatto questa piccola classe per estendere la classe che il metodo scoreToSeq proviene da:
public class MidiSequence extends MidiSynth{
public Sequence getSequence(Score score){
MidiSynth synth = new MidiSynth();
Sequence sequence = null;
try
{
// Here I get the error saying that the method has
// protected access in MidiSynth
sequence = synth.scoreToSeq(score);
}
catch (InvalidMidiDataException e)
{
/*
* In case of an exception, we dump the exception
* including the stack trace to the console.
* Then, we exit the program.
*/
e.printStackTrace();
System.exit(1);
}
return sequence;
}
}
Da Najib Tounsi (non abbastanza rappresentante per commentare): Anche se 'synth.scoreToSeq (punteggio);' dovrebbe essere legale. –