class ArchitectureTest { @ArchTest public static final ArchRule rule1 = classes() .should()... @ArchTest public static final ArchRule rule2 = classes() .should()... @ArchTest public static void rule3(JavaClasses classes) { // } } w +6OJUͱ࿈ܞͤ͞Δ͜ͱͰ "SVD6OJUͰ੍࣮ͨ͠Λ ͦͷ··ςετϝιου ͱͯ͠ఆٛͰ͖Δ w ଞͷςετϑϨʔϜϫʔΫʹ ΈࠐΉ͜ͱՄೳ
= ArchRuleDefinition .noClasses() .that() .resideInAPackage("..service..") .should() .accessClassesThat() .resideInAPackage("..controller.."); rule.check(importedClasses); Lang API w $PSF"1*͔ΒऔಘͰ͖ΔใΛ ݩʹґଘؔͷ੍Λॊೈ͔ͭ ؆ܿʹ࣮͢ΔͨΊͷ"1* w ੍ʹҧ͢ΔΫϥεͳͲ͕ ଘࡏͨ͠߹ʹςετΛ ࣦഊͤ͞Δ͜ͱ͕Ͱ͖Δ w جຊతʹ͜ͷ"1*Λͬͯ ςετΛ࣮͢Δ͜ͱ͕ଟ͍
DescribedPredicate<>( "have a field annotated with @Payload” ) { @Override public boolean apply(JavaClass input) { return checkCustomRule(input); } }; Lang APIͱΧελϜϧʔϧ w %FTDSJCFE1SFEJDBUFͳͲͷ ΠϯλʔϑΣʔεΛ࣮ͯ͠ ಠࣗͷΧελϜϧʔϧΛ ࡞͢Δ͜ͱ͕Մೳ w ࣮ݱ͍ͨ͠ϧʔϧʹରԠ͢Δ "1*͕ଘࡏ͠ͳ͍߹ -BOH"1*ͱ$PSF"1*Λ Έ߹Θ੍ͤͯΛ࣮͢Δ
58 എܠɿࠩͷӨڹൣғͱσάϨ // Τϯϋϯεલ : ਖ਼ͷΛฦ͢ // Τϯϋϯεޙ : Λฦ͢ public int calculate(int input){ var output = ... return output; } // calculate()͕ਖ਼ͷΛฦ͢ͱ͍͏ // લఏʹґଘͯ͠ॲཧΛ࣮ߦ͢Δϝιου public int useCalculate(){ var result = calculate(10); return ... }
{ private final HairColorUsecase usecase; @GetMapping public ResponseEntity<GetHairColorResponse> getHairColor() { final var body = usecase.getHairColors(); return ResponseEntity.body(body); } } w "1*ΤϯυϙΠϯτ IBJSIBJSDPMPST(&5 )BJS$PMPS6TFDBTFΫϥεͷ HFU)BJS$PMPSTϝιουʹ ґଘ͍ͯ͠Δ w Ξϊςʔγϣϯͷ͔Β "1*ΤϯυϙΠϯτͷύε ϝιουऔಘͰ͖Δ HowɿΤϯυϙΠϯτͱ֎෦σʔλͷରԠΛ ϝιουͷґଘ͔ؔΒऔಘ
{ private final HairColorUsecase usecase; @GetMapping public ResponseEntity<GetHairColorResponse> getHairColor() { final var body = usecase.getHairColors(); return ResponseEntity.body(body); } } w "1*ΤϯυϙΠϯτ IBJSIBJSDPMPST(&5 )BJS$PMPS6TFDBTFΫϥεͷ HFU)BJS$PMPSTϝιουʹ ґଘ͍ͯ͠Δ HowɿΤϯυϙΠϯτͱ֎෦σʔλͷରԠΛ ϝιουͷґଘ͔ؔΒऔಘ