All Downloads are FREE. Search and download functionalities are using the official Maven repository.

poussecafe.doc.model.relation.Relation Maven / Gradle / Ivy

There is a newer version: 0.29.0
Show newest version
package poussecafe.doc.model.relation;

import poussecafe.attribute.Attribute;
import poussecafe.discovery.Aggregate;
import poussecafe.domain.AggregateRoot;
import poussecafe.domain.EntityAttributes;

@Aggregate(
  factory = RelationFactory.class,
  repository = RelationRepository.class
)
public class Relation extends AggregateRoot {

    void fromType(ComponentType fromType) {
        attributes().fromType().value(fromType);
    }

    void toType(ComponentType toType) {
        attributes().toType().value(toType);
    }

    public Component fromComponent() {
        return new Component(attributes().fromType().value(), attributes().identifier().value().fromClass());
    }

    public Component toComponent() {
        return new Component(attributes().toType().value(), attributes().identifier().value().toClass());
    }

    public static interface Attributes extends EntityAttributes {

        Attribute fromType();

        Attribute toType();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy