}
protected void addExpressions (DocletTag[] tags, String selector, PrintWriter pw, String collectionName, File sourceFile) {
String fileName = sourceFile != null ? sourceFile.getPath ().replace ('\\', '/') : "<unknown>";
for (int i = 0; i < tags.length; i++) {
DocletTag tag = tags[i];
if (isAttribute (tag)) {
String tagName = tag.getName ();
String tagValue = tag.getValue ();
String expression = tagName + " " + tagValue;
expression = expression.trim ();
// Remove the second @-sign.
expression = expression.substring (1);
if (selector != null) {
if (expression.startsWith (".")) {
// We have selector, tag does...
String tagSelector = expression.substring (1, expression.indexOf (" "));
expression = expression.substring (expression.indexOf (" ")).trim ();
if (!selector.equals (tagSelector)) {
// ...but they didn't match.
continue;
}
} else {
// We have selector, but tag doesn't
continue;
}
} else {
// No selector, but tag has selector.
if (expression.startsWith (".")) {
continue;
}
}
pw.println (" {");
outputAttributeExpression (pw, expression, fileName, tag.getLineNumber (), "_attr");
pw.println (" Object _oattr = _attr; // Need to erase type information");
pw.println (" if (_oattr instanceof org.apache.commons.attributes.Sealable) {");
pw.println (" ((org.apache.commons.attributes.Sealable) _oattr).seal ();");
pw.println (" }");
pw.println (" " + collectionName + ".add ( _attr );");