List of usage examples for org.eclipse.jdt.internal.compiler.ast ArrayReference ArrayReference
public ArrayReference(Expression rec, Expression pos)
From source file:lombok.eclipse.handlers.ast.EclipseASTMaker.java
License:Open Source License
@Override public ASTNode visitArrayRef(final lombok.ast.ArrayRef node, final Void p) { final ArrayReference arrayReference = new ArrayReference(build(node.getIndexed(), Expression.class), build(node.getIndex(), Expression.class)); setGeneratedByAndCopyPos(arrayReference, source, posHintOf(node)); return arrayReference; }
From source file:org.eclipse.ajdt.core.parserbridge.AJCompilationUnitStructureRequestor.java
License:Open Source License
/** * Only handle certain kinds of expressions * all others will be returned as null/*from w w w. ja va 2 s. co m*/ * * String constants * int constants * arrays * ClassRefs * Enum ref * Annotation ref * * @param ajExpr * @return jdtExpr */ private Expression convertToJDTExpression(org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression ajExpr) { if (ajExpr == null) { return null; } Expression jdtExpr = null; if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.StringLiteralConcatenation) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.StringLiteralConcatenation castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.StringLiteralConcatenation) ajExpr; StringLiteralConcatenation castedJDT = new StringLiteralConcatenation( (StringLiteral) convertToJDTExpression(castedAJ.literals[0]), (StringLiteral) convertToJDTExpression(castedAJ.literals[1])); for (int i = 2; i < castedAJ.literals.length; i++) { // may not be able to handle non-string constants here castedJDT.extendsWith((StringLiteral) convertToJDTExpression(castedAJ.literals[i])); } jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.CharLiteral) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.CharLiteral castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.CharLiteral) ajExpr; CharLiteral castedJDT = new CharLiteral(castedAJ.source(), castedAJ.sourceStart, castedAJ.sourceEnd); jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.DoubleLiteral) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.DoubleLiteral castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.DoubleLiteral) ajExpr; DoubleLiteral castedJDT = new DoubleLiteral(castedAJ.source(), castedAJ.sourceStart, castedAJ.sourceEnd); jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.FloatLiteral) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.FloatLiteral castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.FloatLiteral) ajExpr; FloatLiteral castedJDT = new FloatLiteral(castedAJ.source(), castedAJ.sourceStart, castedAJ.sourceEnd); jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.IntLiteralMinValue) { // ECLIPSE 3.7.1 --- must use reflection since constructors have changed // ORIG // IntLiteralMinValue castedJDT = new IntLiteralMinValue(); org.aspectj.org.eclipse.jdt.internal.compiler.ast.IntLiteralMinValue castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.IntLiteralMinValue) ajExpr; IntLiteral castedJDT = null; try { castedJDT = CompilerASTNodeCompatibilityWrapper.createJDTIntLiteralMinValue(castedAJ); } catch (Exception e) { } jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.IntLiteral) { // ECLIPSE 3.7.1 --- must use reflection since constructors have changed // ORIG // IntLiteralMinValue castedJDT = new IntLiteralMinValue(); org.aspectj.org.eclipse.jdt.internal.compiler.ast.IntLiteral castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.IntLiteral) ajExpr; IntLiteral castedJDT = null; try { castedJDT = CompilerASTNodeCompatibilityWrapper.createJDTIntLiteral(castedAJ); } catch (Exception e) { } jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.FalseLiteral) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.FalseLiteral castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.FalseLiteral) ajExpr; FalseLiteral castedJDT = null; try { castedJDT = CompilerASTNodeCompatibilityWrapper.createJDTFalseLiteral(castedAJ); } catch (Exception e) { } jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.NullLiteral) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.NullLiteral castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.NullLiteral) ajExpr; NullLiteral castedJDT = null; try { castedJDT = CompilerASTNodeCompatibilityWrapper.createJDTNullLiteral(castedAJ); } catch (Exception e) { } jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.TrueLiteral) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.TrueLiteral castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.TrueLiteral) ajExpr; TrueLiteral castedJDT = null; try { castedJDT = CompilerASTNodeCompatibilityWrapper.createJDTTrueLiteral(castedAJ); } catch (Exception e) { } jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.LongLiteralMinValue) { // ECLIPSE 3.7.1 --- must use reflection since constructors have changed // ORIG // IntLiteralMinValue castedJDT = new IntLiteralMinValue(); org.aspectj.org.eclipse.jdt.internal.compiler.ast.LongLiteralMinValue castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.LongLiteralMinValue) ajExpr; LongLiteral castedJDT = null; try { castedJDT = CompilerASTNodeCompatibilityWrapper.createJDTLongLiteralMinValue(castedAJ); } catch (Exception e) { } jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.LongLiteral) { // ECLIPSE 3.7.1 --- must use reflection since constructors have changed // ORIG // IntLiteralMinValue castedJDT = new IntLiteralMinValue(); org.aspectj.org.eclipse.jdt.internal.compiler.ast.LongLiteral castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.LongLiteral) ajExpr; LongLiteral castedJDT = null; try { castedJDT = CompilerASTNodeCompatibilityWrapper.createJDTLongLiteral(castedAJ); } catch (Exception e) { } jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.StringLiteral) { // note that here we capture both StringLiteral and ExtendedStringLiteral org.aspectj.org.eclipse.jdt.internal.compiler.ast.StringLiteral castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.StringLiteral) ajExpr; // can we get away with no line number? StringLiteral castedJDT = new StringLiteral(castedAJ.source(), castedAJ.sourceStart, castedAJ.sourceEnd, 0); jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayInitializer) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayInitializer castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayInitializer) ajExpr; ArrayInitializer castedJDT = new ArrayInitializer(); if (castedAJ.expressions != null) { castedJDT.expressions = new Expression[castedAJ.expressions.length]; for (int i = 0; i < castedJDT.expressions.length; i++) { castedJDT.expressions[i] = convertToJDTExpression(castedAJ.expressions[i]); } } jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression) ajExpr; ArrayAllocationExpression castedJDT = new ArrayAllocationExpression(); castedJDT.type = convertToJDTTypeReference(castedAJ.type); if (castedAJ.dimensions != null) { castedJDT.dimensions = new Expression[castedAJ.dimensions.length]; for (int i = 0; i < castedJDT.dimensions.length; i++) { castedJDT.dimensions[i] = convertToJDTExpression(castedAJ.dimensions[i]); } } castedJDT.initializer = (ArrayInitializer) convertToJDTExpression(castedAJ.initializer); jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldReference) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldReference) ajExpr; FieldReference castedJDT = new FieldReference(castedAJ.token, toPos(castedAJ.sourceStart, castedAJ.sourceEnd)); castedJDT.nameSourcePosition = castedAJ.nameSourcePosition; castedJDT.receiver = convertToJDTExpression(castedAJ.receiver); jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayReference) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayReference) ajExpr; ArrayReference castedJDT = new ArrayReference(convertToJDTExpression(castedAJ.receiver), convertToJDTExpression(castedAJ.position)); jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference) ajExpr; QualifiedNameReference castedJDT = new QualifiedNameReference(castedAJ.tokens, castedAJ.sourcePositions, castedAJ.sourceStart, castedAJ.sourceEnd); castedJDT.indexOfFirstFieldBinding = castedAJ.indexOfFirstFieldBinding; jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleNameReference) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleNameReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleNameReference) ajExpr; SingleNameReference castedJDT = new SingleNameReference(castedAJ.token, toPos(castedAJ.sourceStart, castedAJ.sourceEnd)); jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference) { jdtExpr = convertToJDTTypeReference( (org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference) ajExpr); } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess) { org.aspectj.org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess) ajExpr; ClassLiteralAccess castedJDT = new ClassLiteralAccess(castedAJ.sourceEnd, convertToJDTTypeReference(castedAJ.type)); jdtExpr = castedJDT; } else if (ajExpr instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation) { jdtExpr = convertToJDTAnnotation((org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation) ajExpr); } if (jdtExpr != null) { // now fill in other fields jdtExpr.bits = ajExpr.bits; jdtExpr.implicitConversion = ajExpr.implicitConversion; jdtExpr.sourceStart = ajExpr.sourceStart; jdtExpr.sourceEnd = ajExpr.sourceEnd; jdtExpr.statementEnd = ajExpr.statementEnd; } return jdtExpr; }
From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java
License:Open Source License
protected void consumeArrayAccess(boolean unspecifiedReference) { // ArrayAccess ::= Name '[' Expression ']' ==> true // ArrayAccess ::= PrimaryNoNewArray '[' Expression ']' ==> false //optimize push/pop Expression exp;/*from w ww . j a v a2 s . c om*/ if (unspecifiedReference) { exp = this.expressionStack[this.expressionPtr] = new ArrayReference(getUnspecifiedReferenceOptimized(), this.expressionStack[this.expressionPtr]); } else { this.expressionPtr--; this.expressionLengthPtr--; exp = this.expressionStack[this.expressionPtr] = new ArrayReference( this.expressionStack[this.expressionPtr], this.expressionStack[this.expressionPtr + 1]); } exp.sourceEnd = this.endStatementPosition; }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.lifting.ArrayTranslations.java
License:Open Source License
/** * generate code for prevent null-pointer exceptions * if(r1 == null)return null;/*from w w w . j a v a 2 s. co m*/ * if(r1[i0][i1] == null)continue; * @param currentDimension * @param arrayDimensions * @return an if statement */ private IfStatement generateIfStatement(int currentDimension, int arrayDimensions) { SingleNameReference condLeft = new SingleNameReference(ROLE_ARRAY_ARG, 0); decapsulationInput(condLeft); Expression lastArrayReference = condLeft; for (int idx = 0; idx < currentDimension; idx++) { SingleNameReference pos = new SingleNameReference(generateArrayIndexName(idx), 0); ArrayReference nextArray = new ArrayReference(lastArrayReference, pos); lastArrayReference = nextArray; } Expression condRight = new NullLiteral(0, 0); Expression condition = new EqualExpression(lastArrayReference, condRight, OperatorIds.EQUAL_EQUAL); Statement thenStatement = null; if (currentDimension == 0) { thenStatement = new ReturnStatement(new NullLiteral(0, 0), 0, 0); } else { thenStatement = new ContinueStatement(null, 0, 0); } IfStatement ifStatement = new IfStatement(condition, thenStatement, 0, 0); return ifStatement; }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.lifting.ArrayTranslations.java
License:Open Source License
/** * for(int i0=0;i0 < role.length;i0++) * {/*from w ww. ja v a2 s . com*/ * result = new Base[role.length][][]; * for(...){ * ... * for(int i2=0;i2 < role[i0][i1].length;i2++){ * result[i0][i1][i2] = translate(role[i0][i1][i2]); * } * ... * } * } * @param currentDimension counter for recursion only. invoke initially with 0. * @param arrayDimensions maximum of dimensions of the array * @return the new created ForStatement with all subcycles */ private ForStatement generateForStatement(int currentDimension, int arrayDimensions, AstGenerator gen) { Statement[] init = new Statement[1]; char[] name = generateArrayIndexName(currentDimension); LocalDeclaration initializer = new LocalDeclaration(name, 0, 0); initializer.initialization = IntLiteral.buildIntLiteral("0".toCharArray(), 0, 0); //$NON-NLS-1$ initializer.type = new SingleTypeReference(TypeConstants.INT, 0); init[0] = initializer; SingleNameReference condLeft = new SingleNameReference(name, 0); FieldReference condRight = new FieldReference(IOTConstants.LENGTH, 0); SingleNameReference roleNameReference = gen.singleNameReference(ROLE_ARRAY_ARG); decapsulationInput(roleNameReference); Expression lastArrayReference = roleNameReference; for (int idx = 0; idx < currentDimension; idx++) { SingleNameReference pos = new SingleNameReference(generateArrayIndexName(idx), 0); ArrayReference nextArray = new ArrayReference(lastArrayReference, pos); lastArrayReference = nextArray; } condRight.receiver = lastArrayReference; Expression cond = new BinaryExpression(condLeft, condRight, OperatorIds.LESS); Statement[] inc = new Statement[1]; inc[0] = new PostfixExpression(new SingleNameReference(name, 0), IntLiteral.One, OperatorIds.PLUS, 0); Block action = new Block(0); // result = new Base[role.length][][]; Assignment arrayInstantiation = generateArrayInstantiation(currentDimension + 1, arrayDimensions, gen); // if(r1 == null)continue; IfStatement ifStatement = generateIfStatement(currentDimension + 1, arrayDimensions); if (currentDimension < arrayDimensions - 1) { ForStatement innerForStatement = generateForStatement(currentDimension + 1, arrayDimensions, gen); action.statements = new Statement[3]; action.statements[0] = ifStatement; action.statements[1] = arrayInstantiation; action.statements[2] = innerForStatement; } else { action.statements = new Statement[2]; action.statements[0] = ifStatement; action.statements[1] = arrayInstantiation; } // for(;i0 < role.length;i0++) ForStatement outerForStatement = new ForStatement(init, cond, inc, action, true, 0, 0); return outerForStatement; }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.lifting.ArrayTranslations.java
License:Open Source License
/** * creates AST-Element/*from w w w. jav a 2 s .c o m*/ * * if currentDimension == 1 -> result = new Base[role.length][][]; * if currentDimension == 2 -> result[i0] = new Base[role[i0].length][][]; * if currentDimension == arrayDimensions -> result[i0][i1][i2] = role[i0][i1][i2]._OT$Base; * @param currentDimension some dimensions must have special treatment * @param arrayDimensions maximum of dimensions of the array * @return the new created assignment */ private Assignment generateArrayInstantiation(int currentDimension, int arrayDimensions, AstGenerator gen) { SingleNameReference resultNameReference = new SingleNameReference(IOTConstants.OT_RESULT, 0); decapsulationOutput(resultNameReference); Expression lastArrayReference = resultNameReference; for (int idx = 0; idx < currentDimension; idx++) { SingleNameReference pos = new SingleNameReference(generateArrayIndexName(idx), 0); ArrayReference nextArray = new ArrayReference(lastArrayReference, pos); lastArrayReference = nextArray; } Expression lhsReference = lastArrayReference; lastArrayReference = decapsulationInput(gen.singleNameReference(ROLE_ARRAY_ARG)); for (int idx = 0; idx < currentDimension; idx++) { SingleNameReference pos = new SingleNameReference(generateArrayIndexName(idx), 0); ArrayReference nextArray = new ArrayReference(lastArrayReference, pos); lastArrayReference = nextArray; } Expression rhsReference = lastArrayReference; if (currentDimension == arrayDimensions) { return new Assignment(lhsReference, translation(rhsReference, this._providedType.leafComponentType(), this._requiredType.leafComponentType(), gen), 0); } else { //new Required[role[i0].length][][]; FieldReference lengthFieldReference = new FieldReference(IOTConstants.LENGTH, 0); lengthFieldReference.receiver = rhsReference; TypeReference reqTypeReference = gen.typeReference(this._requiredType.leafComponentType()); decapsulationOutput(reqTypeReference); ArrayAllocationExpression reqAllocationExpression = new ArrayAllocationExpression(); reqAllocationExpression.type = reqTypeReference; reqAllocationExpression.dimensions = new Expression[arrayDimensions - currentDimension]; reqAllocationExpression.dimensions[0] = lengthFieldReference; Assignment assignment = new Assignment(lhsReference, reqAllocationExpression, 0); return assignment; } }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.mappings.CallinImplementor.java
License:Open Source License
private void packUnmappedArgs(MethodSpec baseMethodSpec, CallinMappingDeclaration callinBindingDeclaration, MethodDeclaration callinWrapper, ArrayList<Statement> statements, AstGenerator gen) { int[] unmapped = callinBindingDeclaration.getUnmappedBasePositions(baseMethodSpec); if (unmapped.length == 0) return;// w w w. ja v a 2 s .c o m SourcePosition savePos = gen.getSourcePosition(); gen.setSourcePosition(new StepOverSourcePosition()); try { // must have signatures if mapping present. int unusedIdx; int basePos = 1; // skip base object if (callinBindingDeclaration.isReplaceCallin()) { // we have enhanced arguments including _OT$unusedArgs basePos += getMethodSignatureEnhancer().ENHANCING_ARG_LEN; unusedIdx = 0; // check what is already in _OT$unusedArgs: if (baseMethodSpec.isCallin()) { unusedIdx = getMethodSignatureEnhancer().ENHANCING_ARG_LEN; if (baseMethodSpec.isStatic()) // FIXME(SH): Static role methods other the callin? unusedIdx += 2; // a (dummyInt,MyTeam) pair of synthetics } } else { // no enhanced arguments, means also: no _OT$unusedArgs available yet. statements.add(gen.localVariable(getMethodSignatureEnhancer().UNUSED_ARGS, new ArrayQualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, 1, // dims new long[] { gen.pos, gen.pos, gen.pos }), gen.arrayAllocation(gen.qualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT), unmapped.length, // constant dims null))); unusedIdx = 0; } for (int i = 0; i < unmapped.length; i++) { Argument arg = callinWrapper.arguments[basePos + unmapped[i]]; TypeBinding paramType = arg.type.resolvedType; Expression rhs = gen.singleNameReference(arg.name); if (paramType.isBaseType()) rhs = gen.createBoxing(rhs, (BaseTypeBinding) paramType); statements.add(gen.assignment( new ArrayReference(gen.singleNameReference(getMethodSignatureEnhancer().UNUSED_ARGS), gen.intLiteral(unusedIdx++)), rhs)); } } finally { gen.setSourcePosition(savePos); } }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.util.AstGenerator.java
License:Open Source License
public ArrayReference arrayReference(Expression expression, int index) { return setPos(new ArrayReference(expression, intLiteral(index))); }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.util.AstGenerator.java
License:Open Source License
public ArrayReference arrayReference(Expression expression, Expression indexExpression) { return setPos(new ArrayReference(expression, indexExpression)); }
From source file:org.nabucco.framework.generator.compiler.transformation.java.common.reflection.NabuccoToJavaPropertiesVisitor.java
License:Open Source License
/** * Creates a 'put' statement for the static 'createPropertyContainer' method. Adding one * property of the given type to the map of NabuccoPropertyDescriptors utilizing the the * matching PropertyDescriptorSupport create method. * /*from ww w .ja va2 s . c o m*/ * @param fieldName * name of the property/field. * @param fieldType * type name for the property * @param propertyType * the type of property (Basetype,Datatype,List ...) * @param isTechnical * whether the property is technical or not * @param additionalArguments * additional arguments e.g. 'PropertyAssociationType' * * @return an statement that add a PropertyDescriptor to a map. * * @throws JavaModelException * when model creation/modification fails. */ private Statement createPropertyContainerFragment(String fieldName, String fieldType, PropertyType propertyType, boolean isTechnical, List<Expression> additionalArguments) throws JavaModelException { JavaAstModelProducer producer = JavaAstModelProducer.getInstance(); JavaAstMethodCall methodFactory = JavaAstElementFactory.getInstance().getJavaAstMethodCall(); SingleNameReference nameReference = producer.createSingleNameReference(fieldName.toUpperCase()); SingleNameReference mapReference = producer.createSingleNameReference(VARIABLE_PROPERTY_MAP); MessageSend result = producer.createMessageSend(METHOD_PUT, mapReference, Arrays.asList(new Expression[] { nameReference })); SingleNameReference propertyDescriptorSupport = producer.createSingleNameReference(CLASS_SUPPORT); ClassLiteralAccess typeClassLiteralAccess = producer.createClassLiteralAccess(fieldType); SingleNameReference constraints = producer.createSingleNameReference(FIELD_CONSTRAINTS); Literal globalIndex = this.resolveIndex(); String stringIndex = String.valueOf(this.getPropertyStatements.size()); Literal localIndex = producer.createLiteral(stringIndex, LiteralType.INT_LITERAL); Literal technicalFlag; if (isTechnical) { technicalFlag = producer.createLiteral(null, LiteralType.TRUE_LITERAL); } else { technicalFlag = producer.createLiteral(null, LiteralType.FALSE_LITERAL); } ArrayReference arrayReference = new ArrayReference(constraints, localIndex); switch (propertyType) { case BASETYPE: { MessageSend createBasetype = producer.createMessageSend(METHOD_CREATE_BASETYPE, propertyDescriptorSupport, Collections.<Expression>emptyList()); methodFactory.addArgument(nameReference, createBasetype); methodFactory.addArgument(typeClassLiteralAccess, createBasetype); methodFactory.addArgument(globalIndex, createBasetype); methodFactory.addArgument(arrayReference, createBasetype); methodFactory.addArgument(technicalFlag, createBasetype); methodFactory.addArgument(createBasetype, result); break; } case ENUMERATION: { MessageSend createEnum = producer.createMessageSend(METHOD_CREATE_ENUMERATION, propertyDescriptorSupport, Collections.<Expression>emptyList()); methodFactory.addArgument(nameReference, createEnum); methodFactory.addArgument(typeClassLiteralAccess, createEnum); methodFactory.addArgument(globalIndex, createEnum); methodFactory.addArgument(arrayReference, createEnum); methodFactory.addArgument(technicalFlag, createEnum); methodFactory.addArgument(createEnum, result); break; } case DATATYPE: { MessageSend createDatatype = producer.createMessageSend(METHOD_CREATE_DATATYPE, propertyDescriptorSupport, Collections.<Expression>emptyList()); methodFactory.addArgument(nameReference, createDatatype); methodFactory.addArgument(typeClassLiteralAccess, createDatatype); methodFactory.addArgument(globalIndex, createDatatype); methodFactory.addArgument(arrayReference, createDatatype); methodFactory.addArgument(technicalFlag, createDatatype); for (Expression expression : additionalArguments) { methodFactory.addArgument(expression, createDatatype); } methodFactory.addArgument(createDatatype, result); break; } case COLLECTION: { MessageSend createCollection = producer.createMessageSend(METHOD_CREATE_COLLECTION, propertyDescriptorSupport, Collections.<Expression>emptyList()); methodFactory.addArgument(nameReference, createCollection); methodFactory.addArgument(typeClassLiteralAccess, createCollection); methodFactory.addArgument(globalIndex, createCollection); methodFactory.addArgument(arrayReference, createCollection); methodFactory.addArgument(technicalFlag, createCollection); for (Expression expression : additionalArguments) { methodFactory.addArgument(expression, createCollection); } methodFactory.addArgument(createCollection, result); break; } } return result; }