public static <A1, B1> Tuple<A1, B1> of(A1 a1, B1 b1) { return new Tuple<A1, B1>(a1, b1); }
public Tuple(A first, B second, boolean immutable) { this.first = first; this.second = second; this.immutable = immutable; if (this.immutable) { hash = internalHashCode(); } else { hash = 0; } }
public static <A1, B1> Tuple<A1, B1> of(A1 a1, B1 b1) { return new Tuple<A1, B1>(a1, b1); }
@Override public int hashCode() { if (this.immutable) { return this.hash; } return internalHashCode(); }
protected <T> void submitProcessFile( final Queue<Tuple<File, Future<T>>> futures, final File child, final Function<Resource, T> fileProcessor) { final Future<T> fileFuture = this.executorService.submit( new Callable<T>() { @Override public T call() throws Exception { logger.debug("processing file: {}", child); return fileProcessor.apply(new FileSystemResource(child)); } }); logger.debug("queued file processing: {}", child); futures.offer(new Tuple<File, Future<T>>(child, fileFuture)); }
public Tuple(A first, B second, boolean immutable) { this.first = first; this.second = second; this.immutable = immutable; if (this.immutable) { hash = internalHashCode(); } else { hash = 0; } }
protected <T> void submitProcessFile( final Queue<Tuple<File, Future<T>>> futures, final File child, final Function<Resource, T> fileProcessor) { final Future<T> fileFuture = this.executorService.submit( new Callable<T>() { @Override public T call() throws Exception { logger.debug("processing file: {}", child); return fileProcessor.apply(new FileSystemResource(child)); } }); logger.debug("queued file processing: {}", child); futures.offer(new Tuple<File, Future<T>>(child, fileFuture)); }
@Override public int hashCode() { if (this.immutable) { return this.hash; } return internalHashCode(); }
@Override public Tuple<String, Element> exportData(String id) { final Element node = this.exportDataElement(id); if (node == null) { return null; } return new Tuple<String, Element>(id, node); }
protected <T> void submitDirectoryRecurse( final Queue<Tuple<File, Future<T>>> futures, final ConcurrentMap<File, T> results, final File directory, final FileFilter fileFilter, final Function<Resource, T> fileProcessor) { final Future<T> dirFuture = this.executorService.submit( new Callable<T>() { @Override public T call() throws Exception { recurseOnDirectory( futures, results, directory, fileFilter, fileProcessor); return null; } }); logger.debug("queued directory recurse: {}", directory); futures.offer(new Tuple<File, Future<T>>(directory, dirFuture)); }
protected <T> void submitDirectoryRecurse( final Queue<Tuple<File, Future<T>>> futures, final ConcurrentMap<File, T> results, final File directory, final FileFilter fileFilter, final Function<Resource, T> fileProcessor) { final Future<T> dirFuture = this.executorService.submit( new Callable<T>() { @Override public T call() throws Exception { recurseOnDirectory( futures, results, directory, fileFilter, fileProcessor); return null; } }); logger.debug("queued directory recurse: {}", directory); futures.offer(new Tuple<File, Future<T>>(directory, dirFuture)); }
public void addPortletSearchResults(String url, SearchResult result) { final Set<String> tabs = this.getTabs(result); for (final String tab : tabs) { final List<Tuple<SearchResult, String>> typeResults = this.results.getUnchecked(tab); typeResults.add(new Tuple<>(result, url)); } }
/** * Parse the parameter name and the optional portlet window id from a fully qualified query * parameter. */ protected Tuple<String, IPortletWindowId> parsePortletParameterName( HttpServletRequest request, String name, Set<String> additionalPortletIds) { // Look for a 2nd separator which might indicate a portlet window id for (final String additionalPortletId : additionalPortletIds) { final int windowIdIdx = name.indexOf(additionalPortletId); if (windowIdIdx == -1) { continue; } final String paramName = name.substring( PORTLET_PARAM_PREFIX.length() + additionalPortletId.length() + SEPARATOR.length()); final IPortletWindowId portletWindowId = this.portletWindowRegistry.getPortletWindowId(request, additionalPortletId); return new Tuple<String, IPortletWindowId>(paramName, portletWindowId); } final String paramName = this.safeSubstringAfter(PORTLET_PARAM_PREFIX, name); return new Tuple<String, IPortletWindowId>(paramName, null); }
/** * Parse the parameter name and the optional portlet window id from a fully qualified query * parameter. */ protected Tuple<String, IPortletWindowId> parsePortletParameterName( HttpServletRequest request, String name, Set<String> additionalPortletIds) { // Look for a 2nd separator which might indicate a portlet window id for (final String additionalPortletId : additionalPortletIds) { final int windowIdIdx = name.indexOf(additionalPortletId); if (windowIdIdx == -1) { continue; } final String paramName = name.substring( PORTLET_PARAM_PREFIX.length() + additionalPortletId.length() + SEPARATOR.length()); final IPortletWindowId portletWindowId = this.portletWindowRegistry.getPortletWindowId(request, additionalPortletId); return new Tuple<String, IPortletWindowId>(paramName, portletWindowId); } final String paramName = this.safeSubstringAfter(PORTLET_PARAM_PREFIX, name); return new Tuple<String, IPortletWindowId>(paramName, null); }
@Override public Tuple<String, Element> unmarshal(Source source) throws IOException, XmlMappingException { // Convert the StAX XMLEventReader to a dom4j Element final Element node = convertToElement(source); return new Tuple<String, Element>(source.getSystemId(), node); }
@Override public Object unmarshal(Source source) throws IOException, XmlMappingException { if (source instanceof StAXSource) { source = fixStAXSource((StAXSource) source); } final Transformer identityTransformer; try { identityTransformer = this.xmlUtilities.getIdentityTransformer(); } catch (TransformerConfigurationException e) { throw new RuntimeException("Failed to create identity Transformer", e); } final DOMResult domResult = new DOMResult(); try { identityTransformer.transform(source, domResult); } catch (TransformerException e) { throw new RuntimeException("Failed to transform " + source + " into Document", e); } final Document resultDoc = (Document) domResult.getNode(); return new Tuple<String, Document>(source.getSystemId(), resultDoc); }
final Tuple<String, String> tuple = new Tuple<String, String>(fragmentName, tabName); layoutNodeIdNameResolutionCache.put(new Element(targetedLayoutNodeId, tuple)); return tuple;
throws ResourceMissingException { final Tuple<Class<?>, String> cacheKey = new Tuple<Class<?>, String>(requestingClass, resource);
throws ResourceMissingException { final Tuple<Class<?>, String> cacheKey = new Tuple<Class<?>, String>(requestingClass, resource);