/** * Instructs the type checker that a property access is dynamic. * Calling this method automatically sets the handled flag to true. * @param pexp the property or attribute expression * @param returnType the type of the property */ public void makeDynamic(PropertyExpression pexp, ClassNode returnType) { context.getEnclosingMethod().putNodeMetaData(StaticTypesMarker.DYNAMIC_RESOLUTION, Boolean.TRUE); pexp.putNodeMetaData(StaticTypesMarker.DYNAMIC_RESOLUTION, returnType); storeType(pexp, returnType); setHandled(true); if (debug) { LOG.info("Turning '"+pexp.getText()+"' into a dynamic property access of type "+returnType.toString(false)); } }
private void checkAnnotationMemberValue(Expression newValue) { if (newValue instanceof PropertyExpression) { PropertyExpression pe = (PropertyExpression) newValue; if (!(pe.getObjectExpression() instanceof ClassExpression)) { addError("unable to find class '" + pe.getText() + "' for annotation attribute constant", pe.getObjectExpression()); } } else if (newValue instanceof ListExpression) { ListExpression le = (ListExpression) newValue; for (Expression e : le.getExpressions()) { checkAnnotationMemberValue(e); } } }
private void checkAnnotationMemberValue(Expression newValue) { if (newValue instanceof PropertyExpression) { PropertyExpression pe = (PropertyExpression) newValue; if (!(pe.getObjectExpression() instanceof ClassExpression)) { addError("unable to find class '" + pe.getText() + "' for annotation attribute constant", pe.getObjectExpression()); } } else if (newValue instanceof ListExpression) { ListExpression le = (ListExpression) newValue; for (Expression e : le.getExpressions()) { checkAnnotationMemberValue(e); } } }
private void checkAnnotationMemberValue(Expression newValue) { if (newValue instanceof PropertyExpression) { PropertyExpression pe = (PropertyExpression) newValue; if (!(pe.getObjectExpression() instanceof ClassExpression)) { addError("unable to find class '" + pe.getText() + "' for annotation attribute constant", pe.getObjectExpression()); } } else if (newValue instanceof ListExpression) { ListExpression le = (ListExpression) newValue; for (Expression e : le.getExpressions()) { checkAnnotationMemberValue(e); } } }
String rootReference = pe.getText(); PropertyExpression oppositeProperty = (PropertyExpression) oppositeSide; String targetObject = oppositeProperty.getObjectExpression().getText(); ArgumentListExpression args = new ArgumentListExpression(); args.addExpression(new ConstantExpression(rootReference)); args.addExpression(new ConstantExpression(oppositeProperty.getText())); newCode.addStatement(new ExpressionStatement(new MethodCallExpression(new VariableExpression("this"), methodToCall, args)));
arguments = new ArgumentListExpression(); arguments.addExpression(new ConstantExpression(((PropertyExpression)leftExpression).getPropertyAsString())); arguments.addExpression(new ConstantExpression(pe.getText())); methodToCall = PROPERTY_COMPARISON_OPERATOR_TO_CRITERIA_METHOD_MAP.get(operator); arguments = new ArgumentListExpression(); arguments.addExpression(new ConstantExpression(((VariableExpression)leftExpression).getName())); arguments.addExpression(new ConstantExpression(pe.getText())); methodToCall = PROPERTY_COMPARISON_OPERATOR_TO_CRITERIA_METHOD_MAP.get(operator);