/** * Create view instance based on view meta data identified by name and request locale. View instance is created from view * implementation class - {@link ViewMeta#getImplementation()}. * * @param viewName application unique view name. * @return newly create view instance. * @throws BugError if given view name does not designate an existing view. */ @Override public View getView(String viewName) { RequestContext context = Factory.getInstance(RequestContext.class); ViewMeta meta = viewsMetaPool.get(viewName, context.getLocale()); if (meta == null) { throw new BugError("View |%s| not found. View name may be misspelled, forgot to add template file or template name doesn't match views files pattern.", viewName); } AbstractView view = (AbstractView) Classes.newInstance(meta.getImplementation()); view.setMeta(meta); return view; } }