Examples of CastExpression


Examples of org.codehaus.groovy.ast.expr.CastExpression

    }

    private String getMethodName(Expression message) {
        String methodName = null;
        if (message instanceof CastExpression) {
            CastExpression msg = (CastExpression) message;
            if (msg.getType() == ClassHelper.STRING_TYPE) {
                final Expression methodExpr = msg.getExpression();
                if (methodExpr instanceof ConstantExpression)
                  methodName = methodExpr.getText();
            }
        }
View Full Code Here

Examples of org.codehaus.groovy.ast.expr.CastExpression

            if (value instanceof String) {
                pushConstant(ce);
                return;
            }
        }
        new CastExpression(ClassHelper.STRING_TYPE, name).visit(controller.getAcg());
    }
View Full Code Here

Examples of org.codehaus.groovy.ast.expr.CastExpression

        final MethodNode noArgValidateMethod = classNode.getMethod(VALIDATE_METHOD_NAME,ZERO_PARAMETERS);
        if (noArgValidateMethod == null) {
            final BlockStatement validateMethodCode = new BlockStatement();

            final ArgumentListExpression validateInstanceArguments = new ArgumentListExpression();
            validateInstanceArguments.addExpression(new CastExpression(new ClassNode(List.class), new ConstantExpression(null)));
            final Expression callListArgValidateMethod = new MethodCallExpression(new VariableExpression("this"), VALIDATE_METHOD_NAME, validateInstanceArguments);
            validateMethodCode.addStatement(new ReturnStatement(callListArgValidateMethod));
            classNode.addMethod(new MethodNode(
                  VALIDATE_METHOD_NAME, Modifier.PUBLIC, ClassHelper.boolean_TYPE,
                  ZERO_PARAMETERS, EMPTY_CLASS_ARRAY, validateMethodCode));
View Full Code Here

Examples of org.datanucleus.query.expression.CastExpression

        if (primExpr.getLeft() != null)
        {
            // Get value of left expression
            if (primExpr.getLeft() instanceof CastExpression)
            {
                CastExpression castExpr = (CastExpression)primExpr.getLeft();
                Expression castLeftExpr = castExpr.getLeft();
                if (castLeftExpr instanceof PrimaryExpression)
                {
                    value = getValueForPrimaryExpression((PrimaryExpression)castLeftExpr);
                    String castClassName = castExpr.getClassName();
                    if (value != null)
                    {
                        // TODO Do this in the compilation stage, and check for ClassNotResolvedException
                        Class castClass = imports.resolveClassDeclaration(castClassName, clr, null);
                        if (!castClass.isAssignableFrom(value.getClass()))
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CastExpression

     *
     * @param type result type
     * @return expression
     */
    public CastBuilder buildCast(Type type) {
        CastExpression castex = getAST().newCastExpression();
        castex.setType(type);
        return new CastBuilder(this, castex);
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CastExpression

        MethodInvocation extraSetCheckpoint = ast.newMethodInvocation();
        extraSetCheckpoint.setExpression(newNode);
        extraSetCheckpoint.setName(ast.newSimpleName(setCheckpointName));
        extraSetCheckpoint.arguments().add(ast.newSimpleName(CHECKPOINT_NAME));

        CastExpression typeCast = ast.newCastExpression();
        typeCast.setExpression(extraSetCheckpoint);
        typeCast.setType(createType(ast, getClassName(type.getName(), state,
                root)));
        replaceNode(node, typeCast);
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CastExpression

                    Expression rightHandSide;

                    if (fieldType.isPrimitive()) {
                        rightHandSide = restoreMethodCall;
                    } else {
                        CastExpression castExpression = ast.newCastExpression();
                        String typeName = getClassName(fieldType.getName(),
                                state, root);
                        castExpression.setType(createType(ast, typeName));
                        castExpression.setExpression(restoreMethodCall);
                        rightHandSide = castExpression;
                    }

                    Assignment assignment = ast.newAssignment();
                    assignment.setLeftHandSide(ast.newSimpleName(fieldName));
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CastExpression

        // Add the right-hand side expression to the argument list.
        Type rightHandType = Type.getType(rightHand);

        if (!isSpecial && type.isPrimitive() && !type.equals(rightHandType)) {
            // Require an explicit conversion.
            CastExpression castExpression = ast.newCastExpression();
            castExpression.setType(createType(ast, type.getName()));
            castExpression.setExpression((Expression) ASTNode.copySubtree(ast,
                    rightHand));
            rightHand = castExpression;
        } else {
            rightHand = (Expression) ASTNode.copySubtree(ast, rightHand);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CastExpression

    else if(e instanceof ParenthesizedExpression){
      ParenthesizedExpression ex=(ParenthesizedExpression)e;
      processExpression(parent, ex.getExpression(), cu, resource, stack, monitor, HistoryDefinitionLocation.UNDEFINED,false);
    }
    else if(e instanceof CastExpression){
      CastExpression cex=(CastExpression)e;
      processExpression(parent, cex.getExpression(), cu, resource, stack, monitor, HistoryDefinitionLocation.UNDEFINED,false);
    }
    else if(e instanceof ArrayAccess) {
      ArrayAccess ae=(ArrayAccess)e;
     
      HistoryDefinitionLocation arrAccess;
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CastExpression

       
        refresh();
       
      }
       else if(covering instanceof CastExpression) {
         CastExpression ae=(CastExpression)covering;
         HistoryDefinitionLocation dl = new HistoryDefinitionLocation(
              ae.toString(),
              (IFile)resource,
              unit.getLineNumber(0),
              covering,null, HistoryDefinitionLocation.INITIAL);
          processExpression(dl, ae, unit, resource, new LinkedList<MethodInvocation>(), monitor, HistoryDefinitionLocation.CALL,true);
          setCurrentInput(dl);
          addHistoryEntry(dl);
          fContentProvider.addElement(dl);
          refresh();
        }
       else if(covering instanceof ClassInstanceCreation) {
         ClassInstanceCreation ae=(ClassInstanceCreation)covering;
         HistoryDefinitionLocation dl = new HistoryDefinitionLocation(
              ae.toString(),
              (IFile)resource,
              unit.getLineNumber(0),
              covering,null, HistoryDefinitionLocation.CLASS_INSTANCE_CREATION);
          processExpression(dl, ae, unit, resource, new LinkedList<MethodInvocation>(), monitor, HistoryDefinitionLocation.CALL,true);
          setCurrentInput(dl);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.