Version 3

    Hi

     

    I'd like provide you with some API ideas for the planned 3.0.0.X releases.

     

    What was detected as not good in the current 2.0.0-X release

    The following lists IMO the problems with the current API:

    • The Child<T> interface allowing to traverse back to the parent object.
      • This means calling the up() method in the fluent API
      • Dealing with created elements like: List<Property<Properties<PersistenceUnit<PersistenceDescriptor>>>> properties = def.getOrCreateProperties().getAllProperty();
        which looks indeed
        cumbersome.
    • Specialization and convinience behavior is not possible
    • Naming issues, for example getOrCreate() etc.
    • Class names as strings. It is not possible to pass the class reference as overloaded method.
    • and more ...

     

    How solve other XML APIs this

    I am definitely not an expert in this and for sure there are more examples around. But I'd like to focus here on JAXB.In my understanding, JAXB uses an ObjectFactory and setters to create paths.

     

    Here is an example: (Sorry guys but I don't know how to create boxes:-( )

    Project project = factory.createProject();

    project
    .setmodelVersion("4.0.0");
    project
    .setGroupId("redmosquito")
    project
    .setArtifactId("jaxb-fluent-api-ext")
    project
    .setPackaging("jar")
    project
    .setVersion("0.0.1")
    project
    .setName("JAXB FLuent API Extensions");

    Dependency dependency = factory.createDependency();
    dependency
    .setGroupId("org.jvnet.jaxb2_commons");
    dependency
    .setArtifactId("jaxb-xjc");
    dependency
    .setVersion("2.1.10");

    Dependencies dependencies = factory.createDependencies();
    dependencies
    .getDependency().add(dependency);

    project
    .setDependencies(dependencies);

     

    This looks not so good but there is a JAXplugin around that tries to provide a fluent API: http://code.google.com/p/jaxb-fluent-api-ext/wiki/Introduction

    I think we can consider a similar API and this could be a base for later API discussions.

     

    Questions from my side

    I am not able to provide examples of a new API yet. This we can discuss later but I'd like to ask you the following questions:

    • Do we really need a fluent API that allows to traverse back to the parent object? If not, then we have solved the up() issue. This means as well no reference to the descriptor object?
    • Do you think that we need in a way allowing to create objects via a factory class? This would allow to pass specialized classes providing convinienced behavor?
    • Do you think that the jaxb-fluent-api is starting point for detailed API discussions?

     

    Personally, I am busy with projects, as normal since the last two year, but I will help and contribute in the way you need and wish.

     

    Regards,

    Ralf