}
private void detectExtConfigAnnotation(Annotation annotation) {
if (EXT_CONFIG_META_NAME.equals(annotation.getMetaName())) {
if (configClass.getComponentClassName() != null) {
throw new CompilerError(annotation.getSymbol(), "Only one [" + EXT_CONFIG_META_NAME + "] annotation may be given.");
}
CommaSeparatedList<AnnotationParameter> annotationParameters = annotation.getOptAnnotationParameters();
while (annotationParameters != null) {
AnnotationParameter annotationParameter = annotationParameters.getHead();
Ide optNameIde = annotationParameter.getOptName();
if (optNameIde != null) {
String parameterName = optNameIde.getName();
LiteralExpr annotationParameterValue = annotationParameter.getValue();
String parameterValue = null;
if (annotationParameterValue != null) {
JooSymbol symbol = annotationParameterValue.getSymbol();
if (symbol.sym != sym.STRING_LITERAL) {
throw new CompilerError(symbol, "The " + parameterName + " parameter of an [" + EXT_CONFIG_META_NAME + "] annotation must be a string literal.");
}
parameterValue = (String) symbol.getJooValue();
}
if (TARGET_ANNOTATION_PARAMETER_NAME.equals(parameterName)) {
if (parameterValue == null) {
throw new CompilerError(optNameIde.getSymbol(), "The " + parameterName + " parameter of an [" + EXT_CONFIG_META_NAME + "] annotation must have a value.");
}
configClass.setComponentClassName(parameterValue);
} else {
try {
configClass.setType(ConfigClassType.fromExtConfigAttribute(parameterName));
} catch (IllegalArgumentException e) {
throw new CompilerError(optNameIde.getSymbol(), "'" + parameterName + "' is not a valid parameter of an [" + EXT_CONFIG_META_NAME + "] annotation (only 'xtype', 'ptype', 'type', 'gctype' are allowed).", e);
}
configClass.setTypeValue(parameterValue);
}
}
annotationParameters = annotationParameters.getTail();
}
if (configClass.getComponentClassName() == null) {
throw new CompilerError(annotation.getSymbol(), "A " + TARGET_ANNOTATION_PARAMETER_NAME + " parameter must be provided for an [" + EXT_CONFIG_META_NAME + "] annotation.");
}
}
}