public Void visitParamElement(GxpNamespace.GxpElement node) {
AttributeMap attrMap = nodeParts.getAttributes();
String name = getVariableName(attrMap, "name", false);
List<JavaAnnotation> javaAnnotations
= getJavaAnnotations(node, JavaAnnotation.Element.PARAM);
Expression defaultValue = null;
boolean hasDefaultFlag = false;
Pattern regex = null;
Expression constructor = null;
boolean hasConstructorFlag = false;
String content = attrMap.getOptional("content", null);
Type defaultType = null;
boolean consumesContent = content != null;
if (consumesContent) {
if (!"*".equals(content)) {
alertSink.add(new InvalidAttributeValueError(attrMap.getAttribute("content")));
}
if (rootSchema != null) {
defaultType = new ContentType(node.getSourcePosition(),
node.getDisplayName(),
rootSchema);
}
}
Type type = createType(node, attrMap, true, defaultType);
if (type == null) {
// Bail out without trying to construct Parameter.
return null;
}
if (consumesContent && !type.isContent()) {
alertSink.add(new ContentTypeExpectedAlert(node.getSourcePosition(),
node.getDisplayName(),
"when content='*' is set."));
type = defaultType;
}
if (type.takesDefaultParam()) {
defaultValue = attrMap.getOptionalExprValue("default", null);
hasDefaultFlag = attrMap.getBooleanValue("has-default");
}
if (type.takesRegexParam()) {
String regexStr = attrMap.getOptional("regex", null);
if (regexStr != null) {
try {
regex = Pattern.compile(regexStr);
} catch (PatternSyntaxException e) {
alertSink.add(new BadRegexError(node, e.getPattern()));
}
}
} else {
regex = type.getPattern(name);
}
if (type.takesConstructorParam()) {
constructor = attrMap.getOptionalExprValue("constructor", null);
hasConstructorFlag = attrMap.getBooleanValue("has-constructor");
}
SpaceOperatorSet spaceOperators = getSpaceOperators(attrMap);
// Note that we *don't* want to run the comment through space collapsing
// as the space operators specified on a gxp:param actually apply to the
// passed values.
// TODO(laurence): should gxp:param even support nested content?
Expression comment = nodeParts.getContent();
if (!comment.hasStaticString()) {
alertSink.add(new RequiresStaticContentError(node));
comment = new StringConstant(node, null, "");
}
if (name != null) {
FormalParameter formal = new FormalParameter(node, name, consumesContent, type,