public abstract class AbstractImageFileProcessor implements ImageFileProcessor {
private ImageFile primary;
public void setPrimaryFile( ImageFile ifprimary ) { this.primary = if;primary; }
protected ImageFile getPrimaryFile() { return this.primary; }
}
public static void main( String args... ) {
ImageFileProcessor ifp = ImageFileProcessorFactory.createProcessor( args[1] );
ifp.process( args[2] );
System.out.println( "Done" );
}
The Factory would need a method to refresh itself, which could then be tied to a file monitor process that kicks off the refresh event automatically when the file has changed. So many possibilities.
At the risk of evoking ire, you could encapsulate the processor mechanism. In theory, you could make getImageType() a private method, then re-write main:
public static void main( String args... ) {
(new ImageFile( args[1] )).process( args[2] );
System.out.println( "Done" );
}
That is an exercise for the reader.