[ 
https://issues.apache.org/jira/browse/JDO-615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12653523#action_12653523
 ] 

Craig Russell commented on JDO-615:
-----------------------------------

Yet more random comments on patch 5:

InterfaceMetadata extends both Metadata and ComponentMetadata. But 
ComponentMetadata already extends Metadata...

ComponentMetadata might include get/setPersistenceModifier since presumably 
this applies to interfaces as well. That leaves only FieldMetadata for 
ClassMetadata which seems correct.

There are several cases of setXXX that take non-enum, non-primitive values. I'd 
like to eliminate them entirely to avoid user error (reusing metadata elements 
in multiple places). Can each of these cases be justified? Or can we add 
factory methods to the interfaces instead (e.g. newVersionMetadata instead of 
setVersionMetadata)? Then there's no need for setParent either.

ComponentMetadata:
setVersionMetadata
setVersionMetadata
setDatastoreIdentityMetadata
setPrimaryKeyMetadata

DiscriminatorMetadata:
setIndexMetadata

ElementMetadata:
setEmbeddedMetadata
setIndexMetadata
setUniqueMetadata
setForeignKeyMetadata

JoinMetadata:
setForeignKeyMetadata
setPrimaryKeyMetadata

KeyMetadata:
setEmbeddedMetadata
setIndexMetadata
setUniqueMetadata
setForeignKeyMetadata

MemberMetadata:
setArrayMetadata
setCollectionMetadata
setMapMetadata
setJoinMetadata
setEmbeddedMetadata
setElementMetadata
setKeyMetadata
setValueMetadata
setIndexMetadata
setUniqueMetadata
setForeignKeyMetadata

Metadata:
setParent

OrderMetadata:
setIndexMetadata

ValueMetadata:
setEmbeddedMetadata
setIndexMetadata
setUniqueMetadata
setForeignKeyMetadata

VersionMetadata:
setIndexMetadata

In SequenceMetadata, not sure if you intended this to be Class or String... 
None of the other metadata calls use Class.
+     * Method to set the result class name for the query
+     * 
+     * @param cls Result class name
+     */
+    void setFactoryClass(Class cls);



> MetaData specification API
> --------------------------
>
>                 Key: JDO-615
>                 URL: https://issues.apache.org/jira/browse/JDO-615
>             Project: JDO
>          Issue Type: New Feature
>            Reporter: Andy Jefferson
>             Fix For: JDO 2 maintenance release 3
>
>         Attachments: jdometadata-5.patch
>
>
> We can specify MetaData via XML or annotations. The only way missing is via 
> an API. I propose mirroring the XML structure with interfaces of the form
> public interface MetaData
> {
>     addExtension(String key, String value);
>     removeExtension(String key, String value);
>     ...
> }
> public interface FileMetaData
> {
>     addPackage(PackageMetaData pmd);
>     ...
> }
> public interface PackageMetaData
> {
>     addClass(ClassMetaData cmd)
>     ...
> }
> public interface ClassMetaData
> {
>     addField(FieldMetaData fmd)
>     ...
> }
> public interface FieldMetaData
> {
>     setInheritance(InheritanceMetaData inhmd)
>     ...
> }
> and so on.
> We would then require a method on the PMF to register the metadata.
> If there are no objections to such a feature I'll propose a patch to try to 
> provide all current JDO2 capabilities.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to