com.force.sdk.codegen
Class CodeGenerator

java.lang.Object
  extended by com.force.sdk.codegen.CodeGenerator

public final class CodeGenerator
extends Object

Basic Code Generator.

The generator will load up all Force.com schema object (SObject) information for a given Force.com store (organization). It then filters and selects the data that is necessary for code generation and writes this to a Template.

Notice that code generation is analogous to MVC (well, at least the MV parts):

  1. Model = DataFilter, DataSelector. This provides the data that will be used in the template.
  2. View = Template. This represents the physical layout of the code being generated.
  3. A WriterProvider provides Jave Writers to the CodeGenerator to tell it where to write the generated code.

Author:
Tim Kral

Nested Class Summary
static class CodeGenerator.Builder
          Builder pattern for CodeGenerator.
 
Method Summary
 int generateCode(com.sforce.soap.partner.PartnerConnection conn)
          Generates code based on a connection to a Force.com store (organization).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

generateCode

public int generateCode(com.sforce.soap.partner.PartnerConnection conn)
                 throws com.sforce.ws.ConnectionException,
                        IOException
Generates code based on a connection to a Force.com store (organization).

This will make various Force.com API calls to a Force.com store. First, it will run a global describe. Next, it will run full describes on the global describe results. These calls will be batched in the most efficient way possible (that is, making the least number of Force.com API calls).

The full describe results will be filtered and injected into a Template whose contents will then be written to a Java Writer.

Parameters:
conn - a Force.com API connection to the Force.com store (organization) that is to be described for code generation
Returns:
the number of Force.com objects for which code is generated
Throws:
com.sforce.ws.ConnectionException - if an error occurs while connecting to the Force.com store (organization)
IOException - if an error occurs while writing the generated code


Copyright © 2011. All Rights Reserved.