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

com.innovenso.townplan.dsl.traits.HasCompositionRelationships.groovy Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package com.innovenso.townplan.dsl.traits

import com.innovenso.townplan.api.value.RelationshipType
import com.innovenso.townplan.dsl.TownPlanConfigurer
import com.innovenso.townplan.dsl.concepts.AbstractConceptConfigurer
import com.innovenso.townplan.dsl.concepts.relationship.RelationshipConfigurer
import lombok.NonNull

import static groovy.lang.Closure.DELEGATE_ONLY

trait HasCompositionRelationships extends CanConfigureConfigurer {
	abstract String getKey();
	abstract TownPlanConfigurer getTownPlanConfigurer();

	RelationshipConfigurer isComposedOf(@DelegatesTo(value = RelationshipConfigurer, strategy = DELEGATE_ONLY) Closure configurer) {
		getTownPlanConfigurer().relationship configureConfigurer(new RelationshipConfigurer(townPlanConfigurer, RelationshipType.COMPOSITION, getKey()), configurer)
	}

	RelationshipConfigurer isComposedOf(@NonNull String targetKey) {
		getTownPlanConfigurer().relationship new RelationshipConfigurer(townPlanConfigurer, RelationshipType.COMPOSITION, getKey(), targetKey, "is composed of")
	}

	RelationshipConfigurer isComposedOf(@NonNull AbstractConceptConfigurer target) {
		getTownPlanConfigurer().relationship new RelationshipConfigurer(townPlanConfigurer, RelationshipType.COMPOSITION, getKey(), target.key, "is composed of")
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy