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;
	}
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 ; }
Generates a <code>toBuilder()</code> method in the annotated class that looks like this:
<pre>
public ParentBuilder&lt;?, ?&gt; toBuilder() {
return new <i>Foobar</i>BuilderImpl().$fillValuesFrom(this);
}
</pre>