Class ProjectClassGenerator
java.lang.Object
org.eclipse.persistence.sessions.factories.ProjectClassGenerator
Purpose: Allow for a class storing a TopLink project's descriptors (meta-data) to be generated. This class can then be used at runtime to deploy the TopLink descriptor's instead of XML files.
- Author:
- James Sutherland
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPUBLIC: Create a new generator.ProjectClassGenerator
(Project project) PUBLIC: Create a new generator to output the project.ProjectClassGenerator
(Project project, String projectClassName, Writer outputWriter) PUBLIC: Create a new generator to output to the writer.ProjectClassGenerator
(Project project, String projectClassName, String fileName) PUBLIC: Create a new generator to output to the file. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAggregateCollectionMappingLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, AggregateCollectionMapping mapping) protected void
addAggregateObjectMappingLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, AggregateObjectMapping mapping) protected void
addCacheInvalidationPolicyLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) protected void
addCMPPolicyLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, CMPPolicy sourceCMPPolicy) protected void
addConverterLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String converterName, Converter converter) protected void
addDescriptorPropertyLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) protected void
addDirectCollectionMappingLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, DirectCollectionMapping mapping) protected void
addDirectMapMappingLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, DirectMapMapping mapping) protected void
addEventManagerPropertyLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) protected void
addFetchGroupLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, FetchGroup fetchGroup, String fetchGroupIdentifier) protected void
addFetchGroupManagerLine
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) protected void
addForeignReferenceMappingLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, ForeignReferenceMapping mapping) protected void
addHistoryPolicyLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) protected void
addHistoryPolicyLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, HistoryPolicy policy, String policyName) protected void
addHistoryPolicyLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, DirectCollectionMapping mapping, String mappingName) protected void
addHistoryPolicyLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ManyToManyMapping mapping, String mappingName) protected void
addInheritanceLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, InheritancePolicy policy) protected void
addInterfaceLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, InterfacePolicy policy) protected void
addManyToManyMappingLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, ManyToManyMapping mapping) protected void
addMappingLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, DatabaseMapping mapping) protected void
addNamedQueryLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, DatabaseQuery query, DescriptorQueryManager queryManager, int iteration) protected void
addObjectTypeConverterLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String converterName, ObjectTypeConverter converter) protected void
addOneToManyMappingLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, OneToManyMapping mapping) protected void
addOneToOneMappingLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, OneToOneMapping mapping) protected void
addOptimisticLockingLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy policy) protected void
addQueryKeyLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, QueryKey queryKey) protected void
addQueryManagerPropertyLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) protected void
addReturningPolicyLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ReturningPolicy policy) protected void
addReturningPolicyLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ReturningPolicy policy, String policyName) protected void
addTransformationMappingLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, TransformationMapping mapping) protected void
addTypeConversionConverterLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String converterName, TypeConversionConverter converter) protected void
addVariableOneToOneMappingLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, VariableOneToOneMapping mapping) protected void
addXMLInteractionLines
(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, XMLInteraction interaction, String variableName) protected String
buildBuilderString
(String builderString, org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, int iteration, String queryIdentifier) protected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition
protected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition
buildDescriptorMethod
(ClassDescriptor descriptor) protected void
buildExpressionString
(String builderString, org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String queryIdentifier, Expression exp, String attrString) protected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition
buildLoginMethod
(Login datasourceLogin) protected void
This figures out the best name for each descriptor, first using the local class name then the qualified one for duplicates.void
generate()
PUBLIC: Generate the project class, output the java source code to the stream or file.void
generate
(boolean useUnicode) PUBLIC: Generate the project class, output the java source code to the stream or file.protected org.eclipse.persistence.internal.codegen.ClassDefinition
Return a class definition object representing the code to be generated for the project and its descriptors.PUBLIC: Return the name of class to be generated.protected Hashtable
PUBLIC: Return the file name that the generate .java file will be output to.PUBLIC: Return the path that the generate .java file will be output to.PUBLIC: Return the writer the output to.PUBLIC: Return the package name of class to be generated.PUBLIC: Return the project to generate from.protected String
printString
(Object value) Return the printed version of the primitive value object.protected String
removeDots
(String packageName) void
setClassName
(String newClassName) PUBLIC: Set the name of class to be generated.protected String
setDefaultOrAddSequenceString
(Sequence sequence, boolean isSetDefault) protected void
setDescriptorMethodNames
(Hashtable descriptorMethodNames) void
setOutputFileName
(String newOutputFileName) PUBLIC: Set the file name that the generate .java file will be output to.void
setOutputPath
(String newOutputPath) PUBLIC: Set the path that the generate .java file will be output to.void
setOutputWriter
(Writer outputWriter) PUBLIC: Set the writer the output to.void
setPackageName
(String newPackageName) PUBLIC: Set the package name of class to be generated.void
setProject
(Project newProject) PUBLIC: Set the project to generate from.protected Vector
sortMappings
(Vector mappings) Short the mappings by type.static void
PUBLIC: Generate the source code to a project class to the project's descriptor into the writer.static void
PUBLIC: Generate the source code to a project class to the project's descriptor into the file.
-
Field Details
-
className
-
packageName
-
outputPath
-
outputFileName
-
outputWriter
-
project
-
descriptorMethodNames
-
-
Constructor Details
-
ProjectClassGenerator
public ProjectClassGenerator()PUBLIC: Create a new generator. -
ProjectClassGenerator
PUBLIC: Create a new generator to output the project. -
ProjectClassGenerator
PUBLIC: Create a new generator to output to the writer. -
ProjectClassGenerator
PUBLIC: Create a new generator to output to the file.
-
-
Method Details
-
addAggregateCollectionMappingLines
protected void addAggregateCollectionMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, AggregateCollectionMapping mapping) -
addAggregateObjectMappingLines
protected void addAggregateObjectMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, AggregateObjectMapping mapping) -
addCacheInvalidationPolicyLines
protected void addCacheInvalidationPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) -
addCMPPolicyLines
protected void addCMPPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, CMPPolicy sourceCMPPolicy) -
addDescriptorPropertyLines
protected void addDescriptorPropertyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) -
addDirectCollectionMappingLines
protected void addDirectCollectionMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, DirectCollectionMapping mapping) -
addDirectMapMappingLines
protected void addDirectMapMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, DirectMapMapping mapping) -
addFetchGroupManagerLine
protected void addFetchGroupManagerLine(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) -
addFetchGroupLines
protected void addFetchGroupLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, FetchGroup fetchGroup, String fetchGroupIdentifier) -
addEventManagerPropertyLines
protected void addEventManagerPropertyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) -
addForeignReferenceMappingLines
protected void addForeignReferenceMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, ForeignReferenceMapping mapping) -
addHistoryPolicyLines
protected void addHistoryPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) -
addHistoryPolicyLines
protected void addHistoryPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, DirectCollectionMapping mapping, String mappingName) -
addHistoryPolicyLines
protected void addHistoryPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ManyToManyMapping mapping, String mappingName) -
addHistoryPolicyLines
protected void addHistoryPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, HistoryPolicy policy, String policyName) -
addInheritanceLines
protected void addInheritanceLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, InheritancePolicy policy) -
addInterfaceLines
protected void addInterfaceLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, InterfacePolicy policy) -
addManyToManyMappingLines
protected void addManyToManyMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, ManyToManyMapping mapping) -
addMappingLines
protected void addMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, DatabaseMapping mapping) -
addObjectTypeConverterLines
protected void addObjectTypeConverterLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String converterName, ObjectTypeConverter converter) -
addOneToManyMappingLines
protected void addOneToManyMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, OneToManyMapping mapping) -
addOneToOneMappingLines
protected void addOneToOneMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, OneToOneMapping mapping) -
addOptimisticLockingLines
protected void addOptimisticLockingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy policy) -
addQueryKeyLines
protected void addQueryKeyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, QueryKey queryKey) -
addQueryManagerPropertyLines
protected void addQueryManagerPropertyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) -
addXMLInteractionLines
protected void addXMLInteractionLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, XMLInteraction interaction, String variableName) -
addNamedQueryLines
protected void addNamedQueryLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, DatabaseQuery query, DescriptorQueryManager queryManager, int iteration) -
buildBuilderString
-
buildExpressionString
protected void buildExpressionString(String builderString, org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String queryIdentifier, Expression exp, String attrString) -
addReturningPolicyLines
protected void addReturningPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ReturningPolicy policy) -
addReturningPolicyLines
protected void addReturningPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ReturningPolicy policy, String policyName) -
addTransformationMappingLines
protected void addTransformationMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, TransformationMapping mapping) -
addConverterLines
-
addTypeConversionConverterLines
protected void addTypeConversionConverterLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String converterName, TypeConversionConverter converter) -
addVariableOneToOneMappingLines
protected void addVariableOneToOneMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, VariableOneToOneMapping mapping) -
buildConstructor
protected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition buildConstructor() -
buildDescriptorMethod
protected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition buildDescriptorMethod(ClassDescriptor descriptor) -
buildLoginMethod
protected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition buildLoginMethod(Login datasourceLogin) -
setDefaultOrAddSequenceString
-
computeDescriptorMethodNames
protected void computeDescriptorMethodNames()This figures out the best name for each descriptor, first using the local class name then the qualified one for duplicates. -
generate
PUBLIC: Generate the project class, output the java source code to the stream or file. useUnicode determines if unicode escaped characters for non_ASCII charaters will be used.- Throws:
ValidationException
-
generate
PUBLIC: Generate the project class, output the java source code to the stream or file. Unicode escaped characters for non_ASCII charaters will be used.- Throws:
ValidationException
-
generateProjectClass
protected org.eclipse.persistence.internal.codegen.ClassDefinition generateProjectClass()Return a class definition object representing the code to be generated for the project and its descriptors. This class will have one method per descriptor and its toString can be used to convert it to code. -
getClassName
PUBLIC: Return the name of class to be generated. This is the unqualified name. -
getDescriptorMethodNames
-
getOutputFileName
PUBLIC: Return the file name that the generate .java file will be output to. -
getOutputPath
PUBLIC: Return the path that the generate .java file will be output to. -
getOutputWriter
PUBLIC: Return the writer the output to. -
getPackageName
PUBLIC: Return the package name of class to be generated. -
getProject
PUBLIC: Return the project to generate from. -
printString
Return the printed version of the primitive value object. This must determine the class and use the correct constructor arguments. -
removeDots
-
setClassName
PUBLIC: Set the name of class to be generated. This can be qualified or unqualified name and will set the file name to match. -
setDescriptorMethodNames
-
setOutputFileName
PUBLIC: Set the file name that the generate .java file will be output to. If the file does not include .java it will be appended. -
setOutputPath
PUBLIC: Set the path that the generate .java file will be output to. -
setOutputWriter
PUBLIC: Set the writer the output to. -
setPackageName
PUBLIC: Set the package name of class to be generated. -
setProject
PUBLIC: Set the project to generate from. All of the projects descriptors will be stored into the file. -
sortMappings
Short the mappings by type. -
write
PUBLIC: Generate the source code to a project class to the project's descriptor into the writer. -
write
PUBLIC: Generate the source code to a project class to the project's descriptor into the file.
-