use of net.sourceforge.pmd.lang.apex.ast.ASTSoqlExpression in project pmd by pmd.
the class ApexCRUDViolationRule method visit.
@Override
public Object visit(final ASTVariableDeclaration node, Object data) {
String type = node.getNode().getLocalInfo().getType().getApexName();
addVariableToMapping(Helper.getFQVariableName(node), type);
final ASTSoqlExpression soql = node.getFirstChildOfType(ASTSoqlExpression.class);
if (soql != null) {
checkForAccessibility(soql, data);
}
return data;
}
use of net.sourceforge.pmd.lang.apex.ast.ASTSoqlExpression in project pmd by pmd.
the class ApexCRUDViolationRule method visit.
@Override
public Object visit(final ASTFieldDeclaration node, Object data) {
ASTFieldDeclarationStatements field = node.getFirstParentOfType(ASTFieldDeclarationStatements.class);
if (field != null) {
TypeRef a = field.getNode().getTypeName();
List<Identifier> names = a.getNames();
List<TypeRef> typeArgs = a.getTypeArguments();
if (!names.isEmpty()) {
StringBuffer sb = new StringBuffer();
for (Identifier id : names) {
sb.append(id.getValue()).append(".");
}
sb.deleteCharAt(sb.length() - 1);
switch(sb.toString().toLowerCase(Locale.ROOT)) {
case "list":
case "map":
addParametersToMapping(node, typeArgs);
break;
default:
varToTypeMapping.put(Helper.getFQVariableName(node), getSimpleType(sb.toString()));
break;
}
}
}
final ASTSoqlExpression soql = node.getFirstChildOfType(ASTSoqlExpression.class);
if (soql != null) {
checkForAccessibility(soql, data);
}
return data;
}
Aggregations