public interface IMessage { void publish(); } interface IErrorMessage extends IMessage{ StackTraceElement[] getStackTrace(); } interface IObjectFactory { public T create(Class theObjectType, Object[] theParameters); } class MessageFactory implements IObjectFactory{ public T create(Class theObjectType, Object[] theParameters) { return null; } } class Main { public static void main(String[] args) { IErrorMessage message = new MessageFactory().create(IErrorMessage.class, new Object[]{"Foo","Bar"}); } }