throw error(L.l("<{0}> needs a 'name' attribute.",
getTagName()));
JavaTagGenerator tagGen = (JavaTagGenerator) _gen;
TldAttribute attr = new TldAttribute();
attr.setName(_name);
if (_type == null) {
attr.setType(String.class);
}
else {
Class type = loadClass(_type);
if (type == null)
throw error(L.l("type '{0}' is an unknown class for tag attribute {1}.",
_type, _name));
if (type.isPrimitive())
throw error(L.l(
"attribute type '{0}' cannot be a Java primitive for {1}.",
_type,
_name));
attr.setType(type);
}
attr.setRequired(_isRequired);
if (_isFragment && _isRtexprvalue != null)
throw error(L.l("@attribute rtexprvalue cannot be set when fragment is true."));
if (_isFragment && _type != null)
throw error(L.l("@attribute type cannot be set when fragment is true."));
if (_isRtexprvalue == null || Boolean.TRUE.equals(_isRtexprvalue))
attr.setRtexprvalue(Boolean.TRUE);
if (_isFragment)
attr.setType(JspFragment.class);
if (_deferredValue != null && _deferredValueType != null)
throw error(L.l("@attribute deferredValue and deferredValueType may not both be specified"));
if (_deferredMethod != null && _deferredMethodSignature != null)
throw error(L.l("@attribute deferredMethod and deferredMethodSignature may not both be specified"));
if ((_deferredValue != null || _deferredValueType != null)
&& (_deferredMethod != null || _deferredMethodSignature != null))
throw error(L.l("@attribute deferredValue and deferredMethod may not both be specified"));
if (Boolean.TRUE.equals(_deferredValue) || _deferredValueType != null) {
attr.setDeferredValue(new TldAttribute.DeferredValue());
if (_deferredValueType != null)
attr.getDeferredValue().setType(_deferredValueType);
}
if (Boolean.TRUE.equals(_deferredMethod)
|| _deferredMethodSignature != null) {
attr.setDeferredMethod(new TldAttribute.DeferredMethod());
if (_deferredMethodSignature != null)
attr.getDeferredMethod().setMethodSignature(new Signature(_deferredMethodSignature));
}
tagGen.addAttribute(attr);
}