com.force.sdk.codegen
Class ForceJPAClassGeneratorUtils

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

public final class ForceJPAClassGeneratorUtils
extends Object

Shared utilities for the Force.com JPA enabled Java class generator.

Author:
Tim Kral

Field Summary
static Set<String> ALL_OBJECT_COMMON_FIELDS
          The set of fields common to all Force.com objects.
static Set<String> CUSTOM_OBJECT_COMMON_FIELDS
          The set of fields common to all Force.com custom objects.
static String INDENT
          Represents a tab (consisting of spaces).
static String NEWLINE
          Represents a system independent new line character.
static Set<String> STANDARD_OBJECT_COMMON_FIELDS
          The set of fields common to *most* Force.com standard objects.
 
Method Summary
static String constructPackageName(com.sforce.soap.partner.GetUserInfoResult userInfo)
          Constructs a Java package name based on a Force.com store name (Organization name).
static boolean hasAllCommonFields(com.sforce.soap.partner.DescribeSObjectResult dsr)
          Determines if a Force.com object has all standard Force.com fields.
static String renderJavaName(com.sforce.soap.partner.DescribeSObjectResult dsr, boolean firstCharLowerCase)
          Constructs a valid Java name from a Force.com DescribeSObjectResult object name.
static String renderJavaName(com.sforce.soap.partner.Field field, boolean firstCharLowerCase)
          Constructs a valid Java name from a Force.com API Field object name.
static boolean useRelationshipName(com.sforce.soap.partner.Field field)
          Determines if a Java name should be constructed from the given Force.com API Field object's relationship name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDENT

public static final String INDENT
Represents a tab (consisting of spaces).

See Also:
Constant Field Values

NEWLINE

public static final String NEWLINE
Represents a system independent new line character.


ALL_OBJECT_COMMON_FIELDS

public static final Set<String> ALL_OBJECT_COMMON_FIELDS
The set of fields common to all Force.com objects.


STANDARD_OBJECT_COMMON_FIELDS

public static final Set<String> STANDARD_OBJECT_COMMON_FIELDS
The set of fields common to *most* Force.com standard objects.


CUSTOM_OBJECT_COMMON_FIELDS

public static final Set<String> CUSTOM_OBJECT_COMMON_FIELDS
The set of fields common to all Force.com custom objects.

Method Detail

constructPackageName

public static String constructPackageName(com.sforce.soap.partner.GetUserInfoResult userInfo)
Constructs a Java package name based on a Force.com store name (Organization name).

Parameters:
userInfo - the Force.com user who is running the code generation
Returns:
a non null String which conforms to Java class naming standards

hasAllCommonFields

public static boolean hasAllCommonFields(com.sforce.soap.partner.DescribeSObjectResult dsr)
Determines if a Force.com object has all standard Force.com fields.

Parameters:
dsr - a Force.com DescribeSObjectResult of the object to be tested
Returns:
true if and only if the given object contains all common Force.com fields
See Also:
STANDARD_OBJECT_COMMON_FIELDS

renderJavaName

public static String renderJavaName(com.sforce.soap.partner.DescribeSObjectResult dsr,
                                    boolean firstCharLowerCase)
Constructs a valid Java name from a Force.com DescribeSObjectResult object name.

Parameters:
dsr - a Force.com DescribeSObjectResult object whose name is to to converted to a Java name
firstCharLowerCase - indicates if the first character in the constructed Java name should be lower case
Returns:
a non null String which conforms to Java naming standards

useRelationshipName

public static boolean useRelationshipName(com.sforce.soap.partner.Field field)
Determines if a Java name should be constructed from the given Force.com API Field object's relationship name.

Parameters:
field - the Force.com API Field object to test
Returns:
true if and only if the given Field object is a reference field and has a non null relationship name and only references exactly one other Force.com object

renderJavaName

public static String renderJavaName(com.sforce.soap.partner.Field field,
                                    boolean firstCharLowerCase)
Constructs a valid Java name from a Force.com API Field object name.

Parameters:
field - a Force.com API Field object whose name is to to converted to a Java name
firstCharLowerCase - indicates if the first character in the constructed Java name should be lower case
Returns:
a non null String which conforms to Java naming standards


Copyright © 2011. All Rights Reserved.