Still learning qi4j through real-world use cases I've built before and
running into a road block (but loving the ability to turn a mess of
domain objects into something like an onion!). Here's what I have:

public interface HumanResources {

    @UseDefaults
    Property<List<Position>> positions();

    Position createPosition(String name);
    void deletePosition(Position position);
}

public interface Position {
    Property<String> title();

    @Optional
    Property<String> description();
}

public interface PositionValue extends Position, ValueComposite {
}

public abstract class HumanResourcesMixin implements HumanResources {

    @Structure
    private ValueBuilderFactory vbf;

    public Position createPosition(String name) {

        final ValueBuilder<Position> builder =
vbf.newValueBuilder(Position.class);
        final Position prototype = builder.prototype();
        prototype.title().set(name);

        final Position position = builder.newInstance();
        positions().get().add(position);
        return position;
    }

    public void deletePosition(Position position) {

    }
}


Ok, so HumanResourcesMixin I think needs to implement the positions()
method but I'm stumped about how to do this. I have to tell
HumanResourcesMixin that it needs to use PositionValue as the
implementation for Position. Can you gives point me in the right
direction?!
Thanks,
Aye

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to