private boolean isCorrectEvent(Message message, CommActions commActions) { LinkedHashMap<String, LinkedHashMap> data = (LinkedHashMap) message.getContent().get("data"); LinkedHashMap content = data.get("content"); if (null != content && !content.isEmpty()) { String event = (String) content.getOrDefault("event", ""); return commActions.getAction().equals(event); } return false; }
List<Integer> coll = metaNameToIndex.getOrDefault( metaFieldNames[i], new ArrayList<>() ); coll.add( i ); metaNameToIndex.put( metaFieldNames[i], coll );
/** * @param headerName case-insensitive header name * @return values for the header, or the empty list if this header is not present. */ public List<String> get(String headerName) { return headersByCapitalizedName.getOrDefault( toUppercaseAscii(headerName), NULL_HEADER).values; }
/** * @param headerName case-insensitive header name * @return values for the header, or the empty list if this header is not present. */ public List<String> get(String headerName) { return headersByCapitalizedName.getOrDefault( toUppercaseAscii(headerName), NULL_HEADER).values; }
@Override public synchronized Object getOrDefault(Object key, Object defaultValue) { return propertyMap.getOrDefault(key, defaultValue); }
/** * Get the rank value for this reference * @param reference - locale reference to the name of this rank * @return rank value or zero if this is an unknown rank */ public int getRankValue(String reference) { return ranks.getOrDefault(reference, VISITOR_RANK); }
@Override public String getProperty(String key, String defaultValue) { return (String) propertyMap.getOrDefault(key, defaultValue); }
/** * Returns the namespace a page is in. There is no need to override this to * add custom namespaces, though you may want to define static fields e.g. * {@code public static final int PORTAL_NAMESPACE = 100;} for the Portal * namespace on the English Wikipedia. * * @param title any valid page name * @return an integer representing the namespace of <var>title</var> * @throws UncheckedIOException if the namespace cache has not been * populated, and a network error occurs when populating it * @see #namespaceIdentifier(int) * @since 0.03 */ public int namespace(String title) { ensureNamespaceCache(); // perform a limited normalization if (title.startsWith(":")) title = title.substring(1); if (!title.contains(":")) return MAIN_NAMESPACE; title = title.replace("_", " "); String namespace = title.substring(0, 1).toUpperCase(locale) + title.substring(1, title.indexOf(':')); return namespaces.getOrDefault(namespace, MAIN_NAMESPACE); }
Integer value = map.getOrDefault(key, 0) + 1;
} else if (languageTag.equals(likelySubtags.get(language))) { prio = 3; } else if (likelySubtags.getOrDefault(language, "").startsWith(languageScript)) { prio = 4; } else {
AttributeParser ap = builder.attributeParsers.getOrDefault(adXmlName, ad.getParser()); if (ap != null && ap.isParseAsElement()) { attributeElements.put(ap.getXmlName(ad), ad);
AttributeParser ap = builder.attributeParsers.getOrDefault(adXmlName, ad.getParser()); if (ap != null && ap.isParseAsElement()) { attributeElements.put(ap.getXmlName(ad), ad);
public JBrowserDriver createBrowserInstance() { Integer socketTimeout = (Integer) pluginConfig.getOrDefault("socket.timeout", DEFAULT_TIMEOUT); Integer connectTimeout = (Integer) pluginConfig.getOrDefault("connect.timeout", DEFAULT_TIMEOUT); return new JBrowserDriver(Settings.builder() .timezone(Timezone.AMERICA_NEWYORK) .quickRender(true) .headless(true) .ignoreDialogs(true) .ajaxResourceTimeout(DEFAULT_TIMEOUT) .ajaxWait(DEFAULT_TIMEOUT).socketTimeout(socketTimeout) .connectTimeout(connectTimeout).build()); }
/** * Find DefinitonNode in module * @param path path of definition node * @param module module to search definition in */ private DefinitionNodeImpl findDefinitionNode(final JcrPath path, final ModuleImpl module) { for (ConfigDefinitionImpl configDefinition : module.getConfigDefinitions()) { final DefinitionNodeImpl definitionNode = configDefinition.getNode(); if (path.equals(definitionNode.getJcrPath())) { return definitionNode; } else if (path.startsWith(definitionNode.getJcrPath())) { final JcrPath pathDiff = definitionNode.getJcrPath().relativize(path); DefinitionNodeImpl currentNode = configDefinition.getNode(); for (final JcrPathSegment jcrPathSegment : pathDiff) { currentNode = currentNode.getModifiableNodes().getOrDefault(jcrPathSegment.toString(), currentNode.getModifiableNodes().get(jcrPathSegment.forceIndex().toString())); if (currentNode == null) { break; //wrong path } else if (currentNode.getJcrPath().equals(path)) { return currentNode; } } } } return null; }