/** * Returns <code>true</code> if tag should be closed on EOF. */ public boolean implicitlyCloseTagOnEOF(String nodeName) { if (nodeName == null) { return false; } nodeName = nodeName.toLowerCase(); return StringUtil.equalsOne(nodeName, CLOSED_ON_EOF) != -1; } }
@Test void testEquals() { assertTrue(StringUtil.equals("1", "1")); assertFalse(StringUtil.equals("1", null)); assertFalse(StringUtil.equals(null, "2")); assertTrue(StringUtil.equals((String) null, null)); assertFalse(StringUtil.equals(new String[] {"abc", "de"}, new String[] {"abc"})); assertFalse(StringUtil.equalsIgnoreCase(new String[] {"abc", "de"}, new String[] {"ABC"})); assertFalse(StringUtil.equalsIgnoreCase(new String[] {"abc", "de"}, new String[] {"ab", "dE"})); assertEquals(2, StringUtil.equalsOne("src", "123", null, "src")); assertEquals(-1, StringUtil.equalsOne("src", "123", null, "Src")); assertEquals(2, StringUtil.equalsOneIgnoreCase("sRc", "123", null, "Src")); assertEquals(-1, StringUtil.equalsOneIgnoreCase("sRc", "123", null, "Dsrc")); }
/** * Returns <code>true</code> if parent node tag can be closed implicitly. */ public boolean implicitlyCloseParentTagOnNewTag(String parentNodeName, String nodeName) { if (parentNodeName == null) { return false; } parentNodeName = parentNodeName.toLowerCase(); nodeName = nodeName.toLowerCase(); for (int i = 0; i < IMPLIED_ON_START.length; i+=2) { if (StringUtil.equalsOne(parentNodeName, IMPLIED_ON_START[i]) != -1) { if (StringUtil.equalsOne(nodeName, IMPLIED_ON_START[i + 1]) != -1) { return true; } } } return false; }
/** * Returns <code>true</code> if current end tag (node name) closes the parent tag. */ public boolean implicitlyCloseParentTagOnTagEnd(String parentNodeName, String nodeName) { if (parentNodeName == null) { return false; } parentNodeName = parentNodeName.toLowerCase(); nodeName = nodeName.toLowerCase(); for (int i = 0; i < IMPLIED_ON_END.length; i += 2) { if (StringUtil.equalsOne(nodeName, IMPLIED_ON_END[i]) != -1) { if (StringUtil.equalsOne(parentNodeName, IMPLIED_ON_END[i + 1]) != -1) { return true; } } } return false; }
/** * Returns <code>true</code> if provided element is one of the table-related elements. */ protected boolean isOneOfTableElements(final Element element) { String elementName = element.getNodeName().toLowerCase(); return StringUtil.equalsOne(elementName, TABLE_ELEMENTS) != -1; }
StringUtil.equalsOne(entryMimeType, mimeTypes);
/** * Returns <code>true</code> if parent node is one of the table elements. */ protected boolean isParentNodeOneOfFosterTableElements(final Node parentNode) { if (parentNode == null) { return false; } if (parentNode.getNodeName() == null) { return false; } String nodeName = parentNode.getNodeName().toLowerCase(); return StringUtil.equalsOne(nodeName, FOSTER_TABLE_ELEMENTS) != -1; }
/** * Finds all extensions that belong to given mime type(s). * If wildcard mode is on, provided mime type is wildcard pattern. * @param mimeType list of mime types, separated by comma * @param useWildcard if set, mime types are wildcard patterns */ public static String[] findExtensionsByMimeTypes(String mimeType, final boolean useWildcard) { final ArrayList<String> extensions = new ArrayList<>(); mimeType = mimeType.toLowerCase(); final String[] mimeTypes = StringUtil.splitc(mimeType, ", "); for (final Map.Entry<String, String> entry : MIME_TYPE_MAP.entrySet()) { final String entryExtension = entry.getKey(); final String entryMimeType = entry.getValue().toLowerCase(); final int matchResult = useWildcard ? Wildcard.matchOne(entryMimeType, mimeTypes) : StringUtil.equalsOne(entryMimeType, mimeTypes); if (matchResult != -1) { extensions.add(entryExtension); } } if (extensions.isEmpty()) { return StringPool.EMPTY_ARRAY; } return extensions.toArray(new String[0]); }
public ActionRuntime lookup(final String method, final String[] pathChunks) { while (true) { final ActionRuntime actionRuntime = _lookup(method, pathChunks); if (actionRuntime != null) { return actionRuntime; } if (actionsManager.isStrictRoutePaths()) { return null; } // special case final String lastPath = pathChunks[pathChunks.length - 1]; final int lastNdx = lastPath.lastIndexOf('.'); if (lastNdx == -1) { return null; } final String pathExtension = lastPath.substring(lastNdx + 1); if (StringUtil.equalsOne(pathExtension, actionsManager.getPathExtensionsToStrip()) == -1) { return null; } pathChunks[pathChunks.length - 1] = lastPath.substring(0, lastNdx); } }
extension = extension.toLowerCase(); if (StringUtil.equalsOne(extension, extensions) != -1) { result = true;
/** * Returns <code>true</code> if tag should be closed on EOF. */ public boolean implicitlyCloseTagOnEOF(String nodeName) { if (nodeName == null) { return false; } nodeName = nodeName.toLowerCase(); return StringUtil.equalsOne(nodeName, CLOSED_ON_EOF) != -1; } }
/** * Returns <code>true</code> if tag name is void. * If void tags are not defined, returns <code>false</code> * for any input. */ public boolean isVoidTag(String tagName) { if (voidTags == null) { return false; } tagName = tagName.toLowerCase(); return StringUtil.equalsOne(tagName, voidTags) != -1; }
/** * Returns <code>true</code> if tag should be closed on EOF. */ public boolean implicitlyCloseTagOnEOF(String nodeName) { if (nodeName == null) { return false; } nodeName = nodeName.toLowerCase(); return StringUtil.equalsOne(nodeName, CLOSED_ON_EOF) != -1; } }
/** * Returns <code>true</code> if current end tag (node name) closes the parent tag. */ public boolean implicitlyCloseParentTagOnTagEnd(String parentNodeName, String nodeName) { if (parentNodeName == null) { return false; } parentNodeName = parentNodeName.toLowerCase(); nodeName = nodeName.toLowerCase(); for (int i = 0; i < IMPLIED_ON_END.length; i += 2) { if (StringUtil.equalsOne(nodeName, IMPLIED_ON_END[i]) != -1) { if (StringUtil.equalsOne(parentNodeName, IMPLIED_ON_END[i + 1]) != -1) { return true; } } } return false; }
/** * Returns <code>true</code> if parent node tag can be closed implicitly. */ public boolean implicitlyCloseParentTagOnNewTag(String parentNodeName, String nodeName) { if (parentNodeName == null) { return false; } parentNodeName = parentNodeName.toLowerCase(); nodeName = nodeName.toLowerCase(); for (int i = 0; i < IMPLIED_ON_START.length; i+=2) { if (StringUtil.equalsOne(parentNodeName, IMPLIED_ON_START[i]) != -1) { if (StringUtil.equalsOne(nodeName, IMPLIED_ON_START[i + 1]) != -1) { return true; } } } return false; }
/** * Returns <code>true</code> if parent node tag can be closed implicitly. */ public boolean implicitlyCloseParentTagOnNewTag(String parentNodeName, String nodeName) { if (parentNodeName == null) { return false; } parentNodeName = parentNodeName.toLowerCase(); nodeName = nodeName.toLowerCase(); for (int i = 0; i < IMPLIED_ON_START.length; i+=2) { if (StringUtil.equalsOne(parentNodeName, IMPLIED_ON_START[i]) != -1) { if (StringUtil.equalsOne(nodeName, IMPLIED_ON_START[i + 1]) != -1) { return true; } } } return false; }
/** * Returns <code>true</code> if provided element is one of the table-related elements. */ protected boolean isOneOfTableElements(final Element element) { String elementName = element.getNodeName().toLowerCase(); return StringUtil.equalsOne(elementName, TABLE_ELEMENTS) != -1; }
/** * Returns <code>true</code> if provided element is one of the table-related elements. */ protected boolean isOneOfTableElements(Element element) { String elementName = element.getNodeName().toLowerCase(); return StringUtil.equalsOne(elementName, TABLE_ELEMENTS) != -1; }
/** * Returns <code>true</code> if parent node is one of the table elements. */ protected boolean isParentNodeOneOfFosterTableElements(final Node parentNode) { if (parentNode == null) { return false; } if (parentNode.getNodeName() == null) { return false; } String nodeName = parentNode.getNodeName().toLowerCase(); return StringUtil.equalsOne(nodeName, FOSTER_TABLE_ELEMENTS) != -1; }
/** * Returns <code>true</code> if parent node is one of the table elements. */ protected boolean isParentNodeOneOfFosterTableElements(Node parentNode) { if (parentNode == null) { return false; } if (parentNode.getNodeName() == null) { return false; } String nodeName = parentNode.getNodeName().toLowerCase(); return StringUtil.equalsOne(nodeName, FOSTER_TABLE_ELEMENTS) != -1; }