attributeSet = new HashSet<String>();
}
protected void addAttribute(MethodDeclaration d, Element tagElement,
Document document) {
TagAttribute tagAttribute = d.getAnnotation(TagAttribute.class);
if (tagAttribute != null) {
String simpleName = d.getSimpleName();
if (simpleName.startsWith("set") || simpleName.startsWith("get")) {
Element attribute = document.createElement("attribute");
String attributeStr = simpleName.substring(3, 4).toLowerCase(Locale.ENGLISH) + simpleName.substring(4);
if (tagAttribute.name().length() > 0) {
attributeStr = tagAttribute.name();
}
checkAttributeDuplicates(attributeStr);
addDescription(d, attribute, document, false);
addLeafTextElement(attributeStr, "name", attribute, document);
addLeafTextElement(Boolean.toString(tagAttribute.required()), "required", attribute, document);
UIComponentTagAttribute componentTagAttribute = d.getAnnotation(UIComponentTagAttribute.class);
if (isMinium12() && !tagAttribute.rtexprvalue()) {
if (componentTagAttribute != null) {
if (componentTagAttribute.expression().isMethodExpression()) {
Element deferredMethod = document.createElement("deferred-method");
StringBuilder signature = new StringBuilder();
signature.append(componentTagAttribute.methodReturnType());
signature.append(" ");
signature.append(attributeStr);
signature.append("(");
signature.append(StringUtils.join(componentTagAttribute.methodSignature(), ", "));
signature.append(")");
addLeafTextElement(signature.toString(), "method-signature", deferredMethod, document);
attribute.appendChild(deferredMethod);
} else if (componentTagAttribute != null && componentTagAttribute.expression().isValueExpression()) {
Element deferredValue = document.createElement("deferred-value");
String type = "java.lang.Object";
if (componentTagAttribute.expression().isValueExpression()) {
if (componentTagAttribute.type().length == 1
// XXX fix me hack
&& !"org.apache.myfaces.tobago.layout.Measure".equals(componentTagAttribute.type()[0])) {
type = componentTagAttribute.type()[0];
}
} else {
type = componentTagAttribute.type()[0];
}
addLeafTextElement(type, "type", deferredValue, document);
attribute.appendChild(deferredValue);
}
} else {
Element deferredValue = document.createElement("deferred-value");
addLeafTextElement(tagAttribute.type(), "type", deferredValue, document);
attribute.appendChild(deferredValue);
}
}
if (tagAttribute.rtexprvalue()) {
addLeafTextElement(Boolean.toString(tagAttribute.rtexprvalue()), "rtexprvalue", attribute, document);
}
tagElement.appendChild(attribute);
} else {
throw new IllegalArgumentException("Only setter allowed found: " + simpleName);
}