Generate common part.

@param method
the method
@param classBuilder
the class builder
@param methodBuilder
the method builder
@param fieldList
the field list
@param mapFields
the map fields
325457
public void generateCommonPart(SQLiteModelMethod method, TypeSpec.Builder classBuilder, MethodSpec.Builder methodBuilder, Set<JQLProjection> fieldList, boolean generateSqlField) {
		generateCommonPart(method, classBuilder, methodBuilder, fieldList, GenerationType.ALL, null, generateSqlField, false);
	}
196413
public FieldAccessor create(final Method method) {

        ArgUtils.notNull(method, "method");

        final FieldAccessor accessor = new FieldAccessor();

        final String methodName = method.getName();
        if(ClassUtils.isGetterMethod(method) || ClassUtils.isBooleanGetterMethod(method)) {
            final String propertyName;
            if(methodName.startsWith("get")) {
                propertyName = Utils.uncapitalize(methodName.substring(3));
            } else {
                propertyName = Utils.uncapitalize(methodName.substring(2));
            }

            // 共通情報の設定
            accessor.name = propertyName;
            accessor.targetType = method.getReturnType();
            accessor.declaringClass = method.getDeclaringClass();

            // getter情報の設定
            setupWithGetter(accessor, method);

            // フィールド情報の設定
            ClassUtils.extractField(accessor.getDeclaringClass(), accessor.getName(), accessor.getType())
                    .ifPresent(field -> setupWithFiled(accessor, field));

            // setter情報の設定
            ClassUtils.extractSetter(accessor.getDeclaringClass(), accessor.getName(), accessor.getType())
                    .ifPresent(setter -> setupWithSetter(accessor, setter));

            // コンポーネントタイプの設定
            if(Collection.class.isAssignableFrom(accessor.getType())) {
                ParameterizedType type = (ParameterizedType) method.getGenericReturnType();
                accessor.componentType = Optional.of((Class<?>) type.getActualTypeArguments()[0]);

            } else if(accessor.getType().isArray()) {
                accessor.componentType = Optional.of(accessor.getType().getComponentType());

            } else if(Map.class.isAssignableFrom(accessor.getType())) {
                ParameterizedType type = (ParameterizedType) method.getGenericReturnType();
                accessor.componentType = Optional.of((Class<?>) type.getActualTypeArguments()[1]);
            }

        } else if(ClassUtils.isSetterMethod(method)) {
            final String propertyName = Utils.uncapitalize(methodName.substring(3));

            // 共通情報の設定
            accessor.name = propertyName;
            accessor.targetType = method.getParameterTypes()[0];
            accessor.declaringClass = method.getDeclaringClass();

            // setter情報の設定
            setupWithSetter(accessor, method);

            // フィールド情報の設定
            ClassUtils.extractField(accessor.getDeclaringClass(), accessor.getName(), accessor.getType())
                    .ifPresent(field -> setupWithFiled(accessor, field));

            // getter情報の設定
            if(ClassUtils.isPrimitiveBoolean(accessor.getType())) {
                ClassUtils.extractBooleanGetter(accessor.getDeclaringClass(), accessor.getName())
                        .ifPresent(getter -> setupWithGetter(accessor, getter));

            } else {
                ClassUtils.extractGetter(accessor.getDeclaringClass(), accessor.getName(), accessor.getType())
                        .ifPresent(getter -> setupWithGetter(accessor, getter));
            }

            // コンポーネントタイプの設定
            if(Collection.class.isAssignableFrom(accessor.getType())) {
                ParameterizedType type = (ParameterizedType) method.getGenericParameterTypes()[0];
                accessor.componentType = Optional.of((Class<?>) type.getActualTypeArguments()[0]);

            } else if(accessor.getType().isArray()) {
                accessor.componentType = Optional.of(accessor.getType().getComponentType());

            } else if(Map.class.isAssignableFrom(accessor.getType())) {
                ParameterizedType type = (ParameterizedType) method.getGenericParameterTypes()[0];
                accessor.componentType = Optional.of((Class<?>) type.getActualTypeArguments()[1]);
            }

        } else {
            throw new IllegalArgumentException(MessageBuilder.create("method.noAccessor")
                    .varWithClass("className", method.getDeclaringClass())
                    .var("methodName", methodName)
                    .format());
        }

        // 位置・ラベル情報のアクセッサの設定
        if(accessor.hasAnnotation(XlsMapColumns.class)) {
            accessor.mapPositionSetter = mapPositionSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
            accessor.mapLabelSetter = mapLabelSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());

        } else if(accessor.hasAnnotation(XlsArrayColumns.class)
                || accessor.hasAnnotation(XlsArrayCells.class)
                || accessor.hasAnnotation(XlsLabelledArrayCells.class)
                || accessor.hasAnnotation(XlsIterateTables.class)){
            // リストや配列形式の場合
            accessor.arrayPositionSetter = arrayPositionSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
            accessor.arrayLabelSetter = arrayLabelSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());

            if(accessor.hasAnnotation(XlsArrayColumns.class)
                    || accessor.hasAnnotation(XlsLabelledArrayCells.class)) {
                // インデックスが付いていないラベルの設定
                accessor.labelSetter = labelSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
            }

        } else {
            // XlsMapColumnsを持たない通常のプロパティの場合
            accessor.positionSetter = positionSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
            accessor.positionGetter = positionGetterFactory.create(accessor.getDeclaringClass(), accessor.getName());

            accessor.labelSetter = labelSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
            accessor.labelGetter = labelGetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
        }


        return accessor;
    }
629728
protected void buildGetMethod(ClassVisitor cw,
                                  ClassDefinition classDef,
                                  FieldDefinition fieldDef) {
        MethodVisitor mv;
        // Get method
        {
            mv = cw.visitMethod( Opcodes.ACC_PUBLIC,
                    fieldDef.getReadMethod(),
                    Type.getMethodDescriptor( Type.getType( BuildUtils.getTypeDescriptor( fieldDef.getTypeName() ) ),
                            new Type[]{} ),
                    null,
                    null );
            mv.visitCode();
            Label l0 = null;
            if ( this.debug ) {
                l0 = new Label();
                mv.visitLabel( l0 );
            }
            mv.visitVarInsn( Opcodes.ALOAD,
                    0 );
            if ( ! fieldDef.hasOverride() ) {
                mv.visitFieldInsn( Opcodes.GETFIELD,
                                   BuildUtils.getInternalType( classDef.getClassName() ),
                                   fieldDef.getName(),
                                   BuildUtils.getTypeDescriptor( fieldDef.getTypeName() ) );
                mv.visitInsn( Type.getType( BuildUtils.getTypeDescriptor( fieldDef.getTypeName() ) ).getOpcode( Opcodes.IRETURN ) );
            } else {
                mv.visitMethodInsn( INVOKESPECIAL,
                                    BuildUtils.getInternalType( classDef.getSuperClass() ),
                                    BuildUtils.getterName( fieldDef.getName(), fieldDef.getOverriding() ),
                                    Type.getMethodDescriptor( Type.getType( BuildUtils.getTypeDescriptor( fieldDef.getOverriding() ) ), new Type[]{} ),
                                    false );
                mv.visitTypeInsn( CHECKCAST, BuildUtils.getInternalType( fieldDef.getTypeName() ) );
                mv.visitInsn( BuildUtils.returnType( fieldDef.getTypeName() ) );
            }

            Label l1 = null;
            if ( this.debug ) {
                l1 = new Label();
                mv.visitLabel( l1 );
                mv.visitLocalVariable( "this",
                        BuildUtils.getTypeDescriptor( classDef.getClassName() ),
                        null,
                        l0,
                        l1,
                        0 );
            }
            mv.visitMaxs( 0,
                    0 );
            mv.visitEnd();
        }
    }
194214
protected void buildSetMethod(ClassVisitor cw,
                                  ClassDefinition classDef,
                                  FieldDefinition fieldDef) {
        MethodVisitor mv;
        // set method
        {
            mv = cw.visitMethod( Opcodes.ACC_PUBLIC,
                    fieldDef.getWriteMethod(),
                    Type.getMethodDescriptor( Type.VOID_TYPE,
                            new Type[]{Type.getType( BuildUtils.getTypeDescriptor( fieldDef.getTypeName() ) )} ),
                    null,
                    null );
            mv.visitCode();
            Label l0 = null;
            if ( this.debug ) {
                l0 = new Label();
                mv.visitLabel( l0 );
            }
            mv.visitVarInsn( Opcodes.ALOAD, 0 );

            if ( classDef.isTraitable() && classDef.isFullTraiting() ) {
                updateTraitableField( mv, classDef, fieldDef );
            } else {
                mv.visitVarInsn( Type.getType( BuildUtils.getTypeDescriptor( fieldDef.getTypeName() ) ).getOpcode( Opcodes.ILOAD ), 1 );
            }

            if ( ! fieldDef.hasOverride() ) {
                mv.visitFieldInsn( Opcodes.PUTFIELD,
                                   BuildUtils.getInternalType( classDef.getClassName() ),
                                   fieldDef.getName(),
                                   BuildUtils.getTypeDescriptor( fieldDef.getTypeName() ) );
            } else {
                mv.visitMethodInsn( INVOKESPECIAL,
                                    BuildUtils.getInternalType( classDef.getSuperClass() ),
                                    BuildUtils.setterName( fieldDef.getName(), fieldDef.getOverriding() ),
                                    Type.getMethodDescriptor( Type.VOID_TYPE,
                                                              new Type[]{Type.getType( BuildUtils.getTypeDescriptor( fieldDef.getOverriding()) )} ),
                                    false );
            }

            if (classDef.isReactive()) {
                mv.visitVarInsn( ALOAD, 0 );
                mv.visitMethodInsn( INVOKEVIRTUAL, BuildUtils.getInternalType( classDef.getClassName() ), "notifyModification", "()V", false );
            }

            mv.visitInsn( Opcodes.RETURN );
            Label l1 = null;
            if ( this.debug ) {
                l1 = new Label();
                mv.visitLabel( l1 );
                mv.visitLocalVariable( "this",
                        BuildUtils.getTypeDescriptor( classDef.getClassName() ),
                        null,
                        l0,
                        l1,
                        0 );
            }
            mv.visitMaxs( 0, 0 );
            mv.visitEnd();
        }
    }
976759
private static void generateInsertForContentProvider(TypeSpec.Builder classBuilder, final SQLiteModelMethod method,
			InsertType insertResultType) {
		final SQLiteDaoDefinition daoDefinition = method.getParent();
		final SQLiteEntity entity = method.getEntity();
		final Set<String> columns = new LinkedHashSet<>();

		MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(method.contentProviderMethodName);
		if (!method.getParent().hasSamePackageOfSchema()) {
			methodBuilder.addModifiers(Modifier.PUBLIC);
		}

		ParameterSpec parameterSpec;
		parameterSpec = ParameterSpec.builder(Uri.class, "uri").build();
		methodBuilder.addParameter(parameterSpec);
		parameterSpec = ParameterSpec.builder(ContentValues.class, "contentValues").build();
		methodBuilder.addParameter(parameterSpec);
		methodBuilder.returns(Long.TYPE);

		SqlBuilderHelper.generateLogForContentProviderBeginning(method, methodBuilder);

		// just detect which columns are admitted
		JQLChecker.getInstance().replace(method, method.jql, new JQLReplacerListenerImpl(method) {

			@Override
			public String onColumnName(String columnName) {
				SQLProperty tempProperty = entity.get(columnName);
				AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, columnName);

				columns.add(tempProperty.columnName);

				return tempProperty.columnName;

			}

			@Override
			public String onColumnFullyQualifiedName(String tableName, String columnName) {
				AssertKripton.fail("Inconsistent state");
				return null;
			}

		});

		// generate columnCheckSet
		SqlBuilderHelper.generateColumnCheckSet(classBuilder, method, columns);

		// retrieve content values
		methodBuilder.addStatement("$T _contentValues=contentValuesForContentProvider(contentValues)",
				KriptonContentValues.class);

		// generate column check
		SqlBuilderHelper.forEachColumnInContentValue(methodBuilder, method, "_contentValues.values().keySet()", true,
				null);

		methodBuilder.addCode("\n");

		String rxIdGetter = "result";

		// extract pathVariables
		// generate get uri variables in content values
		// every controls was done in constructor of SQLiteModelMethod
		for (ContentUriPlaceHolder variable : method.contentProviderUriVariables) {
			SQLProperty entityProperty = entity.get(variable.value);

			if (entityProperty != null) {
				methodBuilder.addCode("// Add parameter $L at path segment $L\n", variable.value,
						variable.pathSegmentIndex);
				TypeName entityPropertyType = entityProperty.getPropertyType().getTypeName();
				if (TypeUtility.isString(entityPropertyType)) {
					methodBuilder.addStatement("contentValues.put($S, uri.getPathSegments().get($L))",
							entityProperty.columnName, variable.pathSegmentIndex);
				} else {
					methodBuilder.addStatement("contentValues.put($S, Long.valueOf(uri.getPathSegments().get($L)))",
							entityProperty.columnName, variable.pathSegmentIndex);
				}
			}

			if (entityProperty.isPrimaryKey()) {
				rxIdGetter = PropertyUtility.getter(entityProperty);
			}
		}

		// generate log for inser operation
		SqlBuilderHelper.generateLogForContentValuesContentProvider(method, methodBuilder);

		ConflictAlgorithmType conflictAlgorithmType = InsertBeanHelper.getConflictAlgorithmType(method);
		String conflictString1 = "";
		String conflictString2 = "";
		if (conflictAlgorithmType != ConflictAlgorithmType.NONE) {
			conflictString1 = "WithOnConflict";
			conflictString2 = ", " + conflictAlgorithmType.getConflictAlgorithm();
			methodBuilder.addCode("// conflict algorithm $L\n", method.jql.conflictAlgorithmType);
		}

		methodBuilder.addComment("insert operation");
		methodBuilder.addStatement("long result = database().insert$L($S, null, _contentValues.values()$L)",
				conflictString1, entity.getTableName(), conflictString2);
		if (method.getParent().getParent().generateRx) {
			SQLProperty primaryKey = entity.getPrimaryKey();
			if (primaryKey.columnType == ColumnType.PRIMARY_KEY) {
				// long autogenerated
				rxIdGetter = "result";
			} else {

				if (primaryKey.isType(String.class)) {
					rxIdGetter = String.format("contentValues.getAsString(\"%s\")", primaryKey.columnName);
				} else {
					rxIdGetter = String.format("contentValues.getAsLong(\"%s\")", primaryKey.columnName);
				}
			}

			GenericSQLHelper.generateSubjectNext(entity, methodBuilder, SubjectType.INSERT, rxIdGetter);
		}

		// support for livedata
		if (daoDefinition.hasLiveData()) {
			methodBuilder.addComment("support for livedata");
			methodBuilder.addStatement(BindDaoBuilder.METHOD_NAME_REGISTRY_EVENT + "(result>0?1:0)");
		}

		methodBuilder.addStatement("return result");

		// javadoc
		// we add at last javadoc, because need info is built at last.
		SqlBuilderHelper.generateJavaDocForContentProvider(method, methodBuilder);

		methodBuilder.addJavadoc("@param uri $S\n", method.contentProviderUriTemplate.replace("*", "[*]"));
		methodBuilder.addJavadoc("@param contentValues content values\n");

		methodBuilder.addJavadoc("@return new row's id\n");

		classBuilder.addMethod(methodBuilder.build());
	}
1098290
private final void writeMethodTo(CodeBuilder builder) {
    builder.visitCode();
    gen(builder);
    try {
      builder.endMethod();
    } catch (Throwable t) {
      // ASM fails in bizarre ways, attach a trace of the thing we tried to generate to the
      // exception.
      throw new RuntimeException("Failed to generate method:\n" + this, t);
    }
  }
1198350
public static void javaProperty2ContentValues(MethodSpec.Builder methodBuilder, TypeName beanClass, String beanName,
			ModelProperty property) {
		TypeName typeName = null;

		if (property != null && property.getPropertyType() != null) {
			typeName = property.getPropertyType().getTypeName();
		}

		if (property != null && property.hasTypeAdapter()) {
			typeName = typeName(property.typeAdapter.dataType);
		}
		SQLTransform transform = lookup(typeName);

		AssertKripton.assertTrueOrUnsupportedFieldTypeException(transform != null, typeName);
		transform.generateWriteProperty2ContentValues(methodBuilder, beanName, beanClass, property);
	}
1202730
public static void generate(TypeSpec.Builder classBuilder, SQLiteModelMethod method) {

		ModifyType updateResultType = detectModifyType(method, method.jql.operationType);

		// if true, field must be associate to ben attributes
		TypeName returnType = method.getReturnClass();

		if (updateResultType == null) {
			throw (new InvalidMethodSignException(method));
		}

		// generate method code
		MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(method.getName()).addAnnotation(Override.class)
				.addModifiers(Modifier.PUBLIC);
		ParameterSpec parameterSpec;
		for (Pair<String, TypeName> item : method.getParameters()) {
			parameterSpec = ParameterSpec.builder(item.value1, item.value0).build();
			methodBuilder.addParameter(parameterSpec);
		}
		methodBuilder.returns(returnType);

		// generate inner code
		updateResultType.generate(classBuilder, methodBuilder, method, returnType);

		MethodSpec methodSpec = methodBuilder.build();
		classBuilder.addMethod(methodSpec);

		if (method.contentProviderEntryPathEnabled) {
			// delete-select, update-select can be used with content provider
			// insert-select no

			// if (method.jql.containsSelectOperation && updateResultType==) {
			// AssertKripton.failWithInvalidMethodSignException(true, method, "
			// SQL with inner SELECT can not be used in content provider");
			// }

			generateModifierForContentProvider(BaseProcessor.elementUtils, classBuilder, method, updateResultType);

		}

	}
172748
public ClassBuilder<T> withMethod(Method method, Expression expression) {
		methods.put(method, expression);
		return this;
	}
850019
protected void generateFormalParameterBuilderImpl() {
		final TypeReference builderInterface = getFormalParameterBuilderInterface();
		final TypeReference builder = getFormalParameterBuilderImpl();
		final StringConcatenationClient content = new StringConcatenationClient() {
			@Override
			protected void appendTo(TargetStringConcatenation it) {
				it.append("/** Builder of a " + getLanguageName() //$NON-NLS-1$
						+ " formal parameter."); //$NON-NLS-1$
				it.newLine();
				it.append(" */"); //$NON-NLS-1$
				it.newLine();
				it.append("@SuppressWarnings(\"all\")"); //$NON-NLS-1$
				it.newLine();
				it.append("public class "); //$NON-NLS-1$
				it.append(builder.getSimpleName());
				it.append(" extends "); //$NON-NLS-1$
				it.append(getAbstractBuilderImpl());
				it.append(" implements "); //$NON-NLS-1$
				it.append(builderInterface);
				it.append(" {"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append(generateMembers(false, false));
				it.append("}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
			}
		};
		final JavaFileAccess javaFile = getFileAccessFactory().createJavaFile(builder, content);
		javaFile.writeTo(getSrcGen());
	}
230776
protected void buildFieldList(final String field, final List<String> fieldList) {
        
        if(Utils.isEmpty(field)) {
            return;
        }
        
        if(!fieldList.contains(field)) {
            fieldList.add(field);
        }
        
        String plainField = String.valueOf(field);
        int keyIndex = plainField.lastIndexOf('[');
        while(keyIndex >= 0) {
            int endKeyIndex = plainField.indexOf(']', keyIndex);
            if(endKeyIndex >= 0) {
                plainField = plainField.substring(0, keyIndex) + plainField.substring(endKeyIndex + 1);
                
                if(!fieldList.contains(plainField)) {
                    fieldList.add(plainField);
                }
                keyIndex = plainField.lastIndexOf('[');
            } else {
                keyIndex = -1;
            }
        }
    }
222187
@Override
	public void generateSpecializedPart(SQLiteModelMethod method, TypeSpec.Builder classBuilder, MethodSpec.Builder methodBuilder, Set<JQLProjection> fieldList, boolean mapFields) {
		methodBuilder.addCode("return _cursor;\n");
		// methodBuilder.endControlFlow();
	}
17225
public static void generateSQLForInsertDynamic(final SQLiteModelMethod method, MethodSpec.Builder methodBuilder) {
		methodBuilder.addComment("generate SQL for insert");
		JQLChecker checker = JQLChecker.getInstance();

		// replace the table name, other pieces will be removed
		String sql = checker.replace(method, method.jql, new JQLReplacerListenerImpl(method) {

			@Override
			public String onBindParameter(String bindParameterName, boolean inStatement) {
				return "?";
			}
		});

		final One<Integer> counter = new One<Integer>(0);
		sql = checker.replaceVariableStatements(method, sql, new JQLReplaceVariableStatementListenerImpl() {

			@Override
			public String onColumnNameSet(String statement) {
				counter.value0++;
				return "%s";
			}

			@Override
			public String onColumnValueSet(String statement) {
				counter.value0++;
				return "%s";
			}

		});

		if (counter.value0 == 2) {
			methodBuilder.addStatement("String _sql=String.format($S, _contentValues.keyList(), _contentValues.keyValueList())", sql);
		} else {
			methodBuilder.addStatement("String _sql=String.format($S, _contentValues.keyList())", sql);
		}
	}
559007
public static void generate(TypeSpec.Builder classBuilder, SQLiteModelMethod method) {
		InsertType insertResultType = detectInsertType(method);

		// if true, field must be associate to ben attributes
		TypeName returnType = method.getReturnClass();

		AssertKripton.failWithInvalidMethodSignException(insertResultType == null, method);

		// generate method code
		MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(method.getName()).addAnnotation(Override.class)
				.addModifiers(Modifier.PUBLIC);

		ParameterSpec parameterSpec;
		for (Pair<String, TypeName> item : method.getParameters()) {
			parameterSpec = ParameterSpec.builder(item.value1, item.value0).build();
			methodBuilder.addParameter(parameterSpec);
		}
		methodBuilder.returns(returnType);

		// fail if we use jql to INSERT_BEAN with operation of INSERT-FOR-SELECT
		// AssertKripton.failWithInvalidMethodSignException(insertResultType ==
		// InsertType.INSERT_BEAN && method.jql.containsSelectOperation, method,
		// "INSERT-FROM-SELECT SQL can not be used with method sign");

		// generate inner code
		methodBuilder.addComment("Specialized Insert - $L - BEGIN", insertResultType.getClass().getSimpleName());
		insertResultType.generate(classBuilder, methodBuilder, method, returnType);
		methodBuilder.addComment("Specialized Insert - $L - END", insertResultType.getClass().getSimpleName());

		MethodSpec methodSpec = methodBuilder.build();
		classBuilder.addMethod(methodSpec);

		if (method.contentProviderEntryPathEnabled) {
			// we need to generate insert for content provider to
			generateInsertForContentProvider(classBuilder, method, insertResultType);
		}

	}
800178
private MethodDeclaration generateToBuilderMethod(String builderClassName, String builderImplClassName, EclipseNode type, TypeParameter[] typeParams, ASTNode source) {
		int pS = source.sourceStart, pE = source.sourceEnd;
		long p = (long) pS << 32 | pE;
		
		MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) type.top().get()).compilationResult);
		out.selector = TO_BUILDER_METHOD_NAME;
		out.modifiers = ClassFileConstants.AccPublic;
		out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
		
		TypeReference[] wildcards = new TypeReference[] {new Wildcard(Wildcard.UNBOUND), new Wildcard(Wildcard.UNBOUND) };
		out.returnType = new ParameterizedSingleTypeReference(builderClassName.toCharArray(), mergeToTypeReferences(typeParams, wildcards), 0, p);
		
		AllocationExpression newClass = new AllocationExpression();
		newClass.type = namePlusTypeParamsToTypeReference(builderImplClassName.toCharArray(), typeParams, p);
		MessageSend invokeFillMethod = new MessageSend();
		invokeFillMethod.receiver = newClass;
		invokeFillMethod.selector = FILL_VALUES_METHOD_NAME;
		invokeFillMethod.arguments = new Expression[] {new ThisReference(0, 0)};
		out.statements = new Statement[] {new ReturnStatement(invokeFillMethod, pS, pE)};
		
		out.traverse(new SetGeneratedByVisitor(source), ((TypeDeclaration) type.get()).scope);
		return out;
	}
1198581
private static void checkFieldsDefinitions(SQLiteModelMethod method, Class<? extends Annotation> annotation) {
		List<String> includedFields = AnnotationUtility.extractAsStringArray(method.getElement(), annotation, AnnotationAttributeType.FIELDS);
		List<String> excludedFields = AnnotationUtility.extractAsStringArray(method.getElement(), annotation, AnnotationAttributeType.EXCLUDED_FIELDS);

		// both elements can not be defined
		if (includedFields.size() > 0 && excludedFields.size() > 0) {
			throw (new IncompatibleAttributesInAnnotationException(method.getParent(), method, method.getAnnotation(annotation), AnnotationAttributeType.FIELDS,
					AnnotationAttributeType.EXCLUDED_FIELDS));
		}
	}
305415
@Override
	public void generateSpecializedPart(SQLiteModelMethod method, TypeSpec.Builder classBuilder, MethodSpec.Builder methodBuilder, Set<JQLProjection> fieldList, boolean mapFields) {
		//LiteralType listenerType=LiteralType.of(OnReadCursorListener.class);
		ClassName listenerType=ClassName.get(OnReadCursorListener.class);
		
		int counter = SqlBuilderHelper.countParameterOfType(method, listenerType);
		if (counter == 0) {
			// non listener found
			throw (new InvalidMethodSignException(method, "there is no parameter of type \"ReadCursorListener\""));
		}
		if (counter > 1) {
			// more than one listener found
			throw (new InvalidMethodSignException(method, "there are more than one parameter of type \"ReadCursorListener\""));
		}

		String listenerName = SqlSelectBuilder.getNameParameterOfType(method, listenerType);

		methodBuilder.addCode("\n");
		methodBuilder.beginControlFlow("if (_cursor.moveToFirst())");

		// generate index from columns
		methodBuilder.addCode("\n");

		methodBuilder.beginControlFlow("do\n");
		methodBuilder.addCode("$L.onRead(_cursor);\n", listenerName);
		methodBuilder.endControlFlow("while (_cursor.moveToNext())");

		// close cursor
		methodBuilder.endControlFlow();
		methodBuilder.endControlFlow();

	}