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

Andy Jefferson commented on JDO-615:
------------------------------------

Proposal to make the interface more typesafe, and more usable. Methods to add 
to supplement the existing methods.

PackageMetadata JDOMetadata.newPackageMetadata(Class cls); // takes the package 
from the class
ClassMetadata JDOMetadata.newClassMetadata(Class cls); // Add package if needed 
then the class
InterfaceMetadata JDOMetadata.newInterfaceMetadata(Class cls); // Add package 
if needed then the class
PackageMetadata.newClassMetadata(Class cls); // takes the class name from the 
class
PackageMetadata.newInterfaceMetadata(Class cls); // takes the interface name 
from the class

ClassMetadata.newFieldMetadata(Field fld); // takes the field name from the 
field
ClassMetadata.newPropertyMetadata(Method meth); // takes the property name from 
the method (bean-style)

so then users code is refactorable. Obviously for the latter two methods the 
user still has to obtain the Field/Method so of limited benefit for those.

> 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: BooleanProperties.patch, jdometadata-6.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