0

In my model, I declared an interface :

Interface('IMovement') {
    date_time 'etd'
    date_time 'rtd'
}

and I have a lot of entities extending this interface :

Entity('Entity1', extend:'IMovement') {
...
}

I would like to enhance the interface by adding a computed property which computes the difference between the dates : rtd-etd.

I added a computed property on the Interface and generated the extension.

public class IMovementExtension extends AbstractComponentExtension<IMovement> {

    public IMovementExtension(IMovement component) {
        super(component);

        //registerNotificationForwarding(component, IMovement.FIELD, IMovement.COMPUTED_FIELD);
    } ...

But the following error is raised by Eclipse :

Bound mismatch: The type IMovement is not a valid substitute for the bounded parameter of the type AbstractComponentExtension

Is there a way to declare computed properties on Interface ?

Ygor
  • 35
  • 7

1 Answers1

1

You can definitely use computed properties on Jspresso interfaces but you have to tell the framework that your interface implements (extends) IComponent so that you can use the extension mecanism.

This is easily achieved by using the services entry as demonstrated below :

Interface('IMovement',
  extension:'IMovementExtension',
  services:['org.jspresso.framework.model.component.IComponent':null]) {
    ...
}