/** * Creates the patient selection component. */ @Override public IPatientSelector create() { try { return patientSelectorClass.newInstance(); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
private static BaseMenuComponent createMenuOrMenuitem(BaseComponent parent) { try { Class<?> clazz = parent instanceof BaseMenuComponent ? Menuitem.class : Menu.class; return (BaseMenuComponent) clazz.newInstance(); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
/** * Create a new instance of the domain class. */ @Override public <T extends BaseResource> T newObject(Class<T> clazz) { try { return clazz.newInstance(); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
protected BasePickerComponent(Class<P> itemClass) { try { converter = itemClass.newInstance(); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
/** * Returns an array of resources matching the location pattern. * * @param locationPattern The location pattern. Supports classpath references. * @return Array of matching resources. */ public static Resource[] getResources(String locationPattern) { try { return resolver.getResources(locationPattern); } catch (IOException e) { throw MiscUtil.toUnchecked(e); } }
private String encode(String username, String password) { try { String credentials = username + ":" + password; return Base64.encodeBase64String(credentials.getBytes("ISO-8859-1")); } catch (UnsupportedEncodingException e) { throw MiscUtil.toUnchecked(e); } } }
public FujionResourceTransformer() { try { bootstrapperTemplate = IOUtils.readLines(getClass().getResourceAsStream("/org/fujion/bootstrapper.htm"), StandardCharsets.UTF_8); } catch (IOException e) { throw MiscUtil.toUnchecked(e); } }
/** * Writes the line of data to the output stream. Automatically appends a new line character. * * @param data Data to write. */ private void write(String data) { try { out.write(data.getBytes()); out.write('\n'); } catch (IOException e) { throw MiscUtil.toUnchecked(e); } }
public WebJar(Resource resource) { try { this.resource = resource; absolutePath = resource.getURL().toString(); int i = absolutePath.lastIndexOf("/webjars/") + 9; int j = absolutePath.indexOf("/", i); name = absolutePath.substring(i, j); i = absolutePath.indexOf("/", j + 1); version = absolutePath.substring(j + 1, i); } catch (IOException e) { throw MiscUtil.toUnchecked(e); } }
public Iterable getIterator() { try { return iterClass != null ? iterClass.newInstance() : SpringUtil.getAppContext().getBean(beanId, Iterable.class); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
private BaseComponent create() { try { BaseComponent comp = clazz.newInstance(); if (switchVal != null) { comp.setAttribute(SWITCH_ATTR, switchVal); } return comp; } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
/** * Returns a factory instance for this component. * * @return The component factory. */ public ComponentFactory getFactory() { try { return ConstructorUtils.invokeConstructor(factoryClass, this); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
@Override public void onEvent(Event event) { try { DrillDownUtil.showDrillDown(component, dataObject, drillDownDisplayClass); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
/** * Returns a resource given its relative path. * * @param relativePath The relative path. * @return Resource corresponding to the relative path. */ public Resource createRelative(String relativePath) { try { return resource.createRelative(relativePath); } catch (IOException e) { throw MiscUtil.toUnchecked(e); } }
/** * Returns the resolved URL for the specified path. * * @param path Path to resolve. * @return The resolved URL. */ public static URL getResourceURL(String path) { try { return ResourceUtils.getURL(path.startsWith("/web/") ? "classpath:" + path : path); } catch (FileNotFoundException e) { throw MiscUtil.toUnchecked(e); } }
/** * The source is a resource. * * @param resource A resource. */ public PageSource(Resource resource) { try { String src = resource.getFilename(); source = src == null ? resource.getDescription() : src; stream = resource.getInputStream(); } catch (IOException e) { throw MiscUtil.toUnchecked(e); } }
public DynamicResource(String filename, Resource resource) { try { description = resource.getDescription(); contentLength = resource.contentLength(); file = File.createTempFile("fujion_", "." + FilenameUtils.getExtension(filename)); FileUtils.copyInputStreamToFile(resource.getInputStream(), file); } catch (IOException e) { throw MiscUtil.toUnchecked(e); } }
private Object getValue(Object bean) { try { return bean == null ? null : isField ? getFieldValue(bean) : getPropertyValue(bean); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
/** * Parse the layout from XML content. * * @param xml The XML content to parse. * @return The root layout element. */ public static Layout parseText(String xml) { try { return parseDocument(XMLUtil.parseXMLFromString(xml)); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
@Override public void parse(ProcessingInstruction pi, PageElement element) { try { PageSource source = new PageSource(getAttribute(pi, "src", true), servletContext); PageParser.getInstance().parse(source, element); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }