You are viewing a single comment's thread. Return to all comments →
Working off @m_hr1 and over engineering for fun...
try{ return (Food)FoodFactory.class.getClassLoader().loadClass(camelCase(order)).newInstance(); } catch ( Exception e ) { return null; } } private String camelCase(String name){ return name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
Java Factory Pattern
You are viewing a single comment's thread. Return to all comments →
Working off @m_hr1 and over engineering for fun...