Examples of MapEntryExpression


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

        if (classNode == null || classNode.getField(fieldName) != null) {
            return null;
        }
       
        MapExpression constructorArguments = new MapExpression();
        constructorArguments.addMapEntryExpression(new MapEntryExpression(new ConstantExpression("testClass"), new ClassExpression(classNode)));
        FieldNode mixinInstanceFieldNode = classNode.addField(fieldName, Modifier.STATIC, fieldType, new ConstructorCallExpression(fieldType, constructorArguments));
        mixinInstanceFieldNode.addAnnotation(new AnnotationNode(ClassHelper.make(MixinInstance.class)));
       
        addJunitRuleFields(classNode);
       
View Full Code Here

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

        ClassNode targetAwareInterface = GrailsASTUtils.findInterface(fieldType, new ClassNode(TestMixinTargetAware.class).getPlainNodeReference());
        if (classNode != null && classNode.getField(fieldName) == null) {
            Expression constructorArgument = new ArgumentListExpression();
            if(targetAwareInterface != null) {
                MapExpression namedArguments = new MapExpression();
                namedArguments.addMapEntryExpression(new MapEntryExpression(new ConstantExpression("target"), new VariableExpression("this")));
                constructorArgument = namedArguments;
            }
            return classNode.addField(fieldName, Modifier.PRIVATE, fieldType,
                new ConstructorCallExpression(fieldType, constructorArgument));
        }
View Full Code Here

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

            List<Expression> expressions = ((TupleExpression) arguments).getExpressions();
            if (expressions.size() == 1 && expressions.get(0) instanceof MapExpression) {
                MapExpression map = (MapExpression) expressions.get(0);
                List<MapEntryExpression> entries = map.getMapEntryExpressions();
                if (entries.size() == 1) {
                    MapEntryExpression mapEntry = entries.get(0);
                    Expression keyExpression = mapEntry.getKeyExpression();
                    try {
                        IncludeType includeType = IncludeType.valueOf(keyExpression.getText().toLowerCase());
                        MethodCallExpression call = new MethodCallExpression(
                                exp.getObjectExpression(),
                                includeType.getMethodName(),
                                new ArgumentListExpression(
                                        mapEntry.getValueExpression()
                                )
                        );
                        call.setImplicitThis(true);
                        call.setSafe(exp.isSafe());
                        call.setSpreadSafe(exp.isSpreadSafe());
View Full Code Here

Examples of org.eclipse.persistence.internal.expressions.MapEntryExpression

        if (!(expression.isQueryKeyExpression())) {
            return null;
        }
       
        if (expression.isMapEntryExpression()){
            MapEntryExpression teExpression = (MapEntryExpression)expression;
           
            // get the expression that we want the table entry for
            QueryKeyExpression baseExpression = (QueryKeyExpression)teExpression.getBaseExpression();
           
            // get the expression that owns the mapping for the table entry
            Expression owningExpression = baseExpression.getBaseExpression();
            ClassDescriptor owningDescriptor = getLeafDescriptorFor(owningExpression, rootDescriptor);
           
            // Get the mapping that owns the table
            CollectionMapping mapping = (CollectionMapping)owningDescriptor.getObjectBuilder().getMappingForAttributeName(baseExpression.getName());
           
            if (teExpression.shouldReturnMapEntry()){
                return mapping;
            }
            if (mapping.getContainerPolicy().isMappedKeyMapPolicy()){
                MappedKeyMapContainerPolicy policy = (MappedKeyMapContainerPolicy)mapping.getContainerPolicy();
                return (DatabaseMapping)policy.getKeyMapping();
View Full Code Here

Examples of org.eclipse.persistence.internal.expressions.MapEntryExpression

     * INTERNAL
     * Generate the a new EclipseLink TableEntryExpression for this node.
     */
    public Expression generateExpression(GenerationContext context) {
        Expression owningExpression = getLeft().generateExpression(context);
        MapEntryExpression whereClause = new MapEntryExpression(owningExpression);
        whereClause.returnMapEntry();
        return whereClause;
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.expressions.MapEntryExpression

     * INTERNAL
     * Generate the a new EclipseLink TableEntryExpression for this node.
     */
    public Expression generateExpression(GenerationContext context) {
        Expression owningExpression = getLeft().generateExpression(context);
        MapEntryExpression whereClause = new MapEntryExpression(owningExpression);
        return whereClause;
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.expressions.MapEntryExpression

    // Create the expression for the collection-valued path expression
    expression.getExpression().accept(this);

    // Now create the ENTRY expression
    MapEntryExpression entryExpression = new MapEntryExpression(queryExpression);
    entryExpression.returnMapEntry();
    queryExpression = entryExpression;

    // Set the expression type
    type[0] = Map.Entry.class;
  }
View Full Code Here

Examples of org.eclipse.persistence.internal.expressions.MapEntryExpression

    // First visit the parent Expression
    expression.getExpression().accept(this);

    // Now create the Expression of the KEY expression
    queryExpression = new MapEntryExpression(queryExpression);
  }
View Full Code Here

Examples of org.eclipse.persistence.internal.expressions.MapEntryExpression

      declaration = queryContext.findDeclaration(variableName);
      declaration.getBaseExpression().accept(ExpressionBuilderVisitor.this);
      localExpression = queryExpression;

      // Create the Map.Entry expression
      MapEntryExpression entryExpression = new MapEntryExpression(localExpression);
      entryExpression.returnMapEntry();
      localExpression = entryExpression;
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.expressions.MapEntryExpression

      IdentificationVariable identificationVariable = (IdentificationVariable) expression.getExpression();

      // Create the Expression for the identification variable
      identificationVariable.accept(ExpressionBuilderVisitor.this);
      localExpression = new MapEntryExpression(queryExpression);

      // Retrieve the mapping's key mapping's descriptor
      descriptor = queryContext.resolveDescriptor(expression);
    }
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.