public static MatchingElementName forAllElementsWithPrefix(final TemplateMode templateMode, final String matchingAllElementsWithPrefix) { Validate.notNull(templateMode, "Template mode cannot be null"); // Prefix can actually be null -> match all elements with no prefix return new MatchingElementName(templateMode, null, matchingAllElementsWithPrefix, false); }
public static MatchingElementName forAllElements(final TemplateMode templateMode) { Validate.notNull(templateMode, "Template mode cannot be null"); return new MatchingElementName(templateMode, null, null, true); }
public static MatchingElementName forElementName(final TemplateMode templateMode, final ElementName matchingElementName) { Validate.notNull(templateMode, "Template mode cannot be null"); Validate.notNull(matchingElementName, "Matching element name cannot be null"); if (templateMode == TemplateMode.HTML && !(matchingElementName instanceof HTMLElementName)) { throw new IllegalArgumentException("Element names for HTML template mode must be of class " + HTMLElementName.class.getName()); } else if (templateMode == TemplateMode.XML && !(matchingElementName instanceof XMLElementName)) { throw new IllegalArgumentException("Element names for XML template mode must be of class " + XMLElementName.class.getName()); } else if (templateMode.isText() && !(matchingElementName instanceof TextElementName)) { throw new IllegalArgumentException("Element names for any text template modes must be of class " + TextElementName.class.getName()); } return new MatchingElementName(templateMode, matchingElementName, null, false); }