I need to make a program that run process on text, audio and video files,
I create an interface class and three class that inherit it
public interface FileProcess{
public void process();
}
public class TextProcess implements FileProcess{
public void process(){System.out.print("Im Text file")};
}
public class VideoProcess implements FileProcess{
public void process(){System.out.print("Im Video file")};
}
public class AudioProcess implements FileProcess{
public void process(){System.out.print("Im Audio file")};
}
I run test that get File from post request (for example a.jpg or 12.txt or aaa.pdf) how can I know what file process to run? in other words how can I know which object process should be created?