Some recent discussions caused me to revisit this problem

Ideally you could have a page like

public class NVLEdit {
        
        @PageActivationContext
        @Property
        @NVL
        private Person person;
        
        @CommitAfter
        Object onSuccess() {
                return NVLIndex.class;
        }

}

that can edit/create Objects, but for various reasons it quickly
becomes more complicated than that. I also wanted Person to be an
Interface to support multiple types of backing stores. What I came up
with was this:

1. Create NVL annotation (named after the SQL function)
2. Create a worker that populates the field if the value is null.
3. Add a hook so you can "persist" the object when needed.

The worker code (and examples) are here

https://github.com/trsvax/tapestry-trsvax/blob/master/src/main/java/com/trsvax/tapestry/misc/services/NVLWorker.java

You can add implementations for Interfaces with

    @Contribute(NVLService.class)
    public static void contributeFactories(Logger logger,
MappedConfiguration<Class, NVLFactory> configuration) {
        configuration.add(Person.class,new ConstructorFactory(logger,
PersonImpl.class));
    }

Barry

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to