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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPUBLIC: 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 voidaddAggregateCollectionMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, AggregateCollectionMapping mapping) protected voidaddAggregateObjectMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, AggregateObjectMapping mapping) protected voidaddCacheInvalidationPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) protected voidaddCMPPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, CMPPolicy sourceCMPPolicy) protected voidaddConverterLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String converterName, Converter converter) protected voidaddDescriptorPropertyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) protected voidaddDirectCollectionMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, DirectCollectionMapping mapping) protected voidaddDirectMapMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, DirectMapMapping mapping) protected voidaddEventManagerPropertyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) protected voidaddFetchGroupLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, FetchGroup fetchGroup, String fetchGroupIdentifier) protected voidaddFetchGroupManagerLine(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) protected voidaddForeignReferenceMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, ForeignReferenceMapping mapping) protected voidaddHistoryPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) protected voidaddHistoryPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, HistoryPolicy policy, String policyName) protected voidaddHistoryPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, DirectCollectionMapping mapping, String mappingName) protected voidaddHistoryPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ManyToManyMapping mapping, String mappingName) protected voidaddInheritanceLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, InheritancePolicy policy) protected voidaddInterfaceLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, InterfacePolicy policy) protected voidaddManyToManyMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, ManyToManyMapping mapping) protected voidaddMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, DatabaseMapping mapping) protected voidaddNamedQueryLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, DatabaseQuery query, DescriptorQueryManager queryManager, int iteration) protected voidaddObjectTypeConverterLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String converterName, ObjectTypeConverter converter) protected voidaddOneToManyMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, OneToManyMapping mapping) protected voidaddOneToOneMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, OneToOneMapping mapping) protected voidaddOptimisticLockingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy policy) protected voidaddQueryKeyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, QueryKey queryKey) protected voidaddQueryManagerPropertyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ClassDescriptor descriptor) protected voidaddReturningPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ReturningPolicy policy) protected voidaddReturningPolicyLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, ReturningPolicy policy, String policyName) protected voidaddTransformationMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, TransformationMapping mapping) protected voidaddTypeConversionConverterLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String converterName, TypeConversionConverter converter) protected voidaddVariableOneToOneMappingLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String mappingName, VariableOneToOneMapping mapping) protected voidaddXMLInteractionLines(org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, XMLInteraction interaction, String variableName) protected StringbuildBuilderString(String builderString, org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, int iteration, String queryIdentifier) protected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinitionprotected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinitionbuildDescriptorMethod(ClassDescriptor descriptor) protected voidbuildExpressionString(String builderString, org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method, String queryIdentifier, Expression exp, String attrString) protected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinitionbuildLoginMethod(Login datasourceLogin) protected voidThis figures out the best name for each descriptor, first using the local class name then the qualified one for duplicates.voidgenerate()PUBLIC: Generate the project class, output the java source code to the stream or file.voidgenerate(boolean useUnicode) PUBLIC: Generate the project class, output the java source code to the stream or file.protected org.eclipse.persistence.internal.codegen.ClassDefinitionReturn 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 HashtablePUBLIC: 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 StringprintString(Object value) Return the printed version of the primitive value object.protected StringremoveDots(String packageName) voidsetClassName(String newClassName) PUBLIC: Set the name of class to be generated.protected StringsetDefaultOrAddSequenceString(Sequence sequence, boolean isSetDefault) protected voidsetDescriptorMethodNames(Hashtable descriptorMethodNames) voidsetOutputFileName(String newOutputFileName) PUBLIC: Set the file name that the generate .java file will be output to.voidsetOutputPath(String newOutputPath) PUBLIC: Set the path that the generate .java file will be output to.voidsetOutputWriter(Writer outputWriter) PUBLIC: Set the writer the output to.voidsetPackageName(String newPackageName) PUBLIC: Set the package name of class to be generated.voidsetProject(Project newProject) PUBLIC: Set the project to generate from.protected VectorsortMappings(Vector mappings) Short the mappings by type.static voidPUBLIC: Generate the source code to a project class to the project's descriptor into the writer.static voidPUBLIC: 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.
-