use of org.codehaus.groovy.ast.expr.ListExpression in project groovy by apache.
the class AbstractASTTransformation method getClassList.
@Deprecated
public List<ClassNode> getClassList(AnnotationNode anno, String name) {
List<ClassNode> list = new ArrayList<ClassNode>();
Expression expr = anno.getMember(name);
if (expr != null && expr instanceof ListExpression) {
final ListExpression listExpression = (ListExpression) expr;
for (Expression itemExpr : listExpression.getExpressions()) {
if (itemExpr != null && itemExpr instanceof ClassExpression) {
ClassNode cn = itemExpr.getType();
if (cn != null)
list.add(cn);
}
}
} else if (expr != null && expr instanceof ClassExpression) {
ClassNode cn = expr.getType();
if (cn != null)
list.add(cn);
}
return list;
}
use of org.codehaus.groovy.ast.expr.ListExpression in project groovy by apache.
the class AbstractASTTransformation method getMemberClassList.
public List<ClassNode> getMemberClassList(AnnotationNode anno, String name) {
List<ClassNode> list = new ArrayList<ClassNode>();
Expression expr = anno.getMember(name);
if (expr == null) {
return null;
}
if (expr instanceof ListExpression) {
final ListExpression listExpression = (ListExpression) expr;
if (isUndefinedMarkerList(listExpression)) {
return null;
}
for (Expression itemExpr : listExpression.getExpressions()) {
if (itemExpr != null && itemExpr instanceof ClassExpression) {
ClassNode cn = itemExpr.getType();
if (cn != null)
list.add(cn);
}
}
} else if (expr instanceof ClassExpression) {
ClassNode cn = expr.getType();
if (isUndefined(cn))
return null;
if (cn != null)
list.add(cn);
}
return list;
}
use of org.codehaus.groovy.ast.expr.ListExpression in project groovy by apache.
the class NewifyASTTransformation method newifyMethodOrField.
private void newifyMethodOrField(AnnotatedNode parent, boolean autoFlag, ListExpression list) {
final ListExpression oldClassesToNewify = classesToNewify;
final boolean oldAuto = auto;
checkClassLevelClashes(list);
checkAutoClash(autoFlag, parent);
classesToNewify = list;
auto = autoFlag;
if (parent instanceof FieldNode) {
super.visitField((FieldNode) parent);
} else {
super.visitMethod((MethodNode) parent);
}
classesToNewify = oldClassesToNewify;
auto = oldAuto;
}
use of org.codehaus.groovy.ast.expr.ListExpression in project groovy by apache.
the class NewifyASTTransformation method newifyDeclaration.
private void newifyDeclaration(DeclarationExpression de, boolean autoFlag, ListExpression list) {
ClassNode cNode = de.getDeclaringClass();
candidate = de;
final ListExpression oldClassesToNewify = classesToNewify;
final boolean oldAuto = auto;
classesToNewify = list;
auto = autoFlag;
super.visitClass(cNode);
classesToNewify = oldClassesToNewify;
auto = oldAuto;
}
use of org.codehaus.groovy.ast.expr.ListExpression in project groovy by apache.
the class AbstractASTTransformation method getMemberList.
@Deprecated
public List<String> getMemberList(AnnotationNode anno, String name) {
List<String> list;
Expression expr = anno.getMember(name);
if (expr != null && expr instanceof ListExpression) {
list = new ArrayList<String>();
final ListExpression listExpression = (ListExpression) expr;
for (Expression itemExpr : listExpression.getExpressions()) {
if (itemExpr != null && itemExpr instanceof ConstantExpression) {
Object value = ((ConstantExpression) itemExpr).getValue();
if (value != null)
list.add(value.toString());
}
}
} else {
list = tokenize(getMemberStringValue(anno, name));
}
return list;
}
Aggregations