private boolean isValid(MustacheTagInfo info, Set<String> validNames) { if (!info.getType().equals(MustacheTagType.SECTION)) { return false; } for (String name : validNames) { if (info.getText().startsWith(name)) { return true; } } return false; }
private boolean isValid(MustacheTagInfo info, Set<String> validNames) { if (!info.getType().equals(MustacheTagType.SECTION)) { return false; } for (String name : validNames) { if (info.getText().startsWith(name)) { return true; } } return false; }
/** * * @param options * @return <code>true</code> if the underlying tag represents a section, * <code>false</code> otherwise */ public static boolean isSection(Options options) { return options.getTagInfo().getType().equals(MustacheTagType.SECTION); }
/** * * @param options * @return <code>true</code> if the underlying tag represents a variable * which shouldn't be escaped, <code>false</code> otherwise */ public static boolean isUnescapeVariable(Options options) { return options.getTagInfo().getType() .equals(MustacheTagType.UNESCAPE_VARIABLE); }
/** * * @param options * @return <code>true</code> if the underlying tag represents a variable, * <code>false</code> otherwise */ public static boolean isVariable(Options options) { return options.getTagInfo().getType().equals(MustacheTagType.VARIABLE) || isUnescapeVariable(options); }
/** * * @param helperClazz * @param definition * @param allowedTypes * @throws MustacheException * If the helper tag type does not match any one of the * specified types */ public static void checkType(Class<? extends Helper> helperClazz, HelperDefinition definition, MustacheTagType... allowedTypes) { Checker.checkArgumentsNotNull(definition, allowedTypes); if (!Arrays.contains(allowedTypes, definition.getTagInfo().getType())) { throw newValidationException("Unsupported tag type", helperClazz, definition); } }