Record Class PresetRule
java.lang.Object
java.lang.Record
dev.archunitjava.presets.PresetRule
- All Implemented Interfaces:
Comparable<PresetRule>
public record PresetRule(String key, PresetRuleMode mode, List<String> subjects, List<String> relatedLayers, Optional<String> displayName, Optional<String> rationale)
extends Record
implements Comparable<PresetRule>
Inspectable recipe that expands to one ordinary
ArchitectureRule.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(PresetRule other) Returns the value of thedisplayNamerecord component.final booleanIndicates whether some other object is "equal to" this one.static PresetRuleexactlyOneLayer(String key) final inthashCode()Returns a hash code value for this object.static PresetRulekey()Returns the value of thekeyrecord component.static PresetRulemayOnlyAccess(String key, String subject, Collection<String> allowedLayers) mode()Returns the value of themoderecord component.static PresetRulenoAccess(String key, String subject, Collection<String> forbiddenLayers) static PresetRuleonlyAccessedBy(String key, String subject, Collection<String> allowedLayers) static PresetRulepublicInterface(String key, Collection<String> consumerLayers, Collection<String> approvedInterfaceLayers) Returns the value of therationalerecord component.Returns the value of therelatedLayersrecord component.subjects()Returns the value of thesubjectsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PresetRule
public PresetRule(String key, PresetRuleMode mode, List<String> subjects, List<String> relatedLayers, Optional<String> displayName, Optional<String> rationale) Creates an instance of aPresetRulerecord class.- Parameters:
key- the value for thekeyrecord componentmode- the value for themoderecord componentsubjects- the value for thesubjectsrecord componentrelatedLayers- the value for therelatedLayersrecord componentdisplayName- the value for thedisplayNamerecord componentrationale- the value for therationalerecord component
-
-
Method Details
-
exactlyOneLayer
-
mayOnlyAccess
public static PresetRule mayOnlyAccess(String key, String subject, Collection<String> allowedLayers) -
noAccess
-
onlyAccessedBy
public static PresetRule onlyAccessedBy(String key, String subject, Collection<String> allowedLayers) -
isolated
-
publicInterface
public static PresetRule publicInterface(String key, Collection<String> consumerLayers, Collection<String> approvedInterfaceLayers) -
as
-
because
-
compareTo
- Specified by:
compareToin interfaceComparable<PresetRule>
-
toString
-
hashCode
-
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). -
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
mode
Returns the value of themoderecord component.- Returns:
- the value of the
moderecord component
-
subjects
-
displayName
-
rationale
-