public static MatchingAttributeName forAllAttributesWithPrefix(final TemplateMode templateMode, final String matchingAllAttributesWithPrefix) { Validate.notNull(templateMode, "Template mode cannot be null"); // Prefix can actually be null -> match all attributes with no prefix return new MatchingAttributeName(templateMode, null, matchingAllAttributesWithPrefix, false); }
public static MatchingAttributeName forAllAttributes(final TemplateMode templateMode) { Validate.notNull(templateMode, "Template mode cannot be null"); return new MatchingAttributeName(templateMode, null, null, true); }
public static MatchingAttributeName forAttributeName(final TemplateMode templateMode, final AttributeName matchingAttributeName) { Validate.notNull(templateMode, "Template mode cannot be null"); Validate.notNull(matchingAttributeName, "Matching attribute name cannot be null"); if (templateMode == TemplateMode.HTML && !(matchingAttributeName instanceof HTMLAttributeName)) { throw new IllegalArgumentException("Attribute names for HTML template mode must be of class " + HTMLAttributeName.class.getName()); } else if (templateMode == TemplateMode.XML && !(matchingAttributeName instanceof XMLAttributeName)) { throw new IllegalArgumentException("Attribute names for XML template mode must be of class " + XMLAttributeName.class.getName()); } else if (templateMode.isText() && !(matchingAttributeName instanceof TextAttributeName)) { throw new IllegalArgumentException("Attribute names for any text template modes must be of class " + TextAttributeName.class.getName()); } return new MatchingAttributeName(templateMode, matchingAttributeName, null, false); }