Some external function to me gives me a java.io.File instance, but I would like to change default behavior for compareTo for that instance on-the-fly. Whats the best approach?
The only thing I can think of is wrapping this File instance into a
public class FileWrapper extends File{
FileWrapper(File in){
//Assign var to the global var
}
@Overrides
public compareTo(File in){ return whatever;}
}
And make all methods override File´s ones and forward the calls to the global wrapped instance pased through constructor, but it´s very ugly...
Maybe I am forgetting some other easier way...