Record Class LayerDependencies
java.lang.Object
java.lang.Record
com.pragma.archetype.domain.model.structure.LayerDependencies
Defines allowed dependencies between architectural layers.
Used to validate that generated code respects dependency rules.
-
Constructor Summary
ConstructorsConstructorDescriptionLayerDependencies(Map<String, List<String>> allowedDependencies) Creates an instance of aLayerDependenciesrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theallowedDependenciesrecord component.booleancanDependOn(String fromLayer, String toLayer) Checks if a layer can depend on another layer.final booleanIndicates whether some other object is "equal to" this one.getAllowedDependenciesFor(String layer) Gets all layers that a given layer can depend on.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.validateDependency(String fromLayer, String toLayer) Validates a dependency relationship.
-
Constructor Details
-
LayerDependencies
Creates an instance of aLayerDependenciesrecord class.- Parameters:
allowedDependencies- the value for theallowedDependenciesrecord component
-
-
Method Details
-
canDependOn
Checks if a layer can depend on another layer.- Parameters:
fromLayer- The layer that wants to dependtoLayer- The layer to depend on- Returns:
- true if the dependency is allowed
-
getAllowedDependenciesFor
Gets all layers that a given layer can depend on.- Parameters:
layer- The layer to check- Returns:
- List of allowed dependencies, or empty list if none
-
validateDependency
Validates a dependency relationship.- Parameters:
fromLayer- The layer that wants to dependtoLayer- The layer to depend on- Returns:
- ValidationResult indicating if dependency is valid
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
allowedDependencies
Returns the value of theallowedDependenciesrecord component.- Returns:
- the value of the
allowedDependenciesrecord component
-