/** * Creates a definition given its representation with wildcards. * * @param d The definition to replace. * @param name The name of the definition to be created. * @param vars The variables to be substituted. * @return The definition that can be rendered. * @since 2.1.0 */ protected Definition replaceDefinition(Definition d, String name, Map<Integer, String> vars) { Definition nudef = new Definition(); nudef.setExtends(replace(d.getExtends(), vars)); nudef.setName(name); nudef.setPreparer(replace(d.getPreparer(), vars)); nudef.setTemplateAttribute(replaceVarsInAttribute(d .getTemplateAttribute(), vars)); Set<String> localAttributeNames = d.getLocalAttributeNames(); if (localAttributeNames != null && !localAttributeNames.isEmpty()) { for (String attributeName : localAttributeNames) { Attribute attr = d.getLocalAttribute(attributeName); Attribute nuattr = replaceVarsInAttribute(attr, vars); nudef.putAttribute(replace(attributeName, vars), nuattr); } } return nudef; }