Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions archunit/src/main/java/com/tngtech/archunit/library/adr/Adr.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright 2014-2025 TNG Technology Consulting GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tngtech.archunit.library.adr;

import com.tngtech.archunit.PublicAPI;

import java.util.List;
import java.util.Optional;

import static com.tngtech.archunit.PublicAPI.Usage.ACCESS;

/**
* Represents an Architecture Decision Record (ADR)
* such as <a href="https://github.com/adr/madr">these templates</a>.
*/
@PublicAPI(usage = ACCESS)
public interface Adr {
@PublicAPI(usage = ACCESS)
Optional<Metadata> metadata();

@PublicAPI(usage = ACCESS)
Adr withMetadata(final Metadata metadata);

@PublicAPI(usage = ACCESS)
String contextAndProblemStatement();

@PublicAPI(usage = ACCESS)
String title();

@PublicAPI(usage = ACCESS)
Optional<List<String>> decisionDrivers();

@PublicAPI(usage = ACCESS)
Adr withDecisionDrivers(final List<String> decisionDrivers);

@PublicAPI(usage = ACCESS)
List<String> consideredOptions();

@PublicAPI(usage = ACCESS)
String decisionOutcome();

@PublicAPI(usage = ACCESS)
Optional<List<String>> consequences();

@PublicAPI(usage = ACCESS)
Adr withConsequences(final List<String> consequences);

@PublicAPI(usage = ACCESS)
Optional<String> confirmation();

@PublicAPI(usage = ACCESS)
Adr withConfirmation(final String confirmation);

@PublicAPI(usage = ACCESS)
Optional<List<OptionProsAndCons>> optionProsAndCons();

@PublicAPI(usage = ACCESS)
Adr withOptionProsAndCons(final List<OptionProsAndCons> optionProsAndCons);

@PublicAPI(usage = ACCESS)
Optional<String> moreInformation();

@PublicAPI(usage = ACCESS)
Adr withMoreInformation(final String moreInformation);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2014-2025 TNG Technology Consulting GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tngtech.archunit.library.adr;

import com.tngtech.archunit.PublicAPI;

import java.util.List;
import java.util.Optional;

import static com.tngtech.archunit.PublicAPI.Usage.ACCESS;

/**
* Metadata of the ADR.
*/
@PublicAPI(usage = ACCESS)
public interface Metadata {
@PublicAPI(usage = ACCESS)
Optional<String> status();

@PublicAPI(usage = ACCESS)
Metadata withStatus(final String status);

@PublicAPI(usage = ACCESS)
Optional<String> date();

@PublicAPI(usage = ACCESS)
Metadata withDate(final String date);

@PublicAPI(usage = ACCESS)
Optional<List<String>> decisionMakers();

@PublicAPI(usage = ACCESS)
Metadata withDecisionMakers(final List<String> decisionMakers);

@PublicAPI(usage = ACCESS)
Optional<List<String>> consulted();

@PublicAPI(usage = ACCESS)
Metadata withConsulted(final List<String> consulted);

@PublicAPI(usage = ACCESS)
Optional<List<String>> informed();

@PublicAPI(usage = ACCESS)
Metadata withInformed(final List<String> informed);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2014-2025 TNG Technology Consulting GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tngtech.archunit.library.adr;

import com.tngtech.archunit.PublicAPI;

import java.util.List;
import java.util.Optional;

import static com.tngtech.archunit.PublicAPI.Usage.ACCESS;

/**
* Represents an option of an ADR with its pros and cons.
*/
@PublicAPI(usage = ACCESS)
public interface OptionProsAndCons {
@PublicAPI(usage = ACCESS)
String title();

@PublicAPI(usage = ACCESS)
Optional<String> description();

@PublicAPI(usage = ACCESS)
OptionProsAndCons withDescription(final String description);

@PublicAPI(usage = ACCESS)
Optional<String> example();

@PublicAPI(usage = ACCESS)
OptionProsAndCons withExample(final String example);

@PublicAPI(usage = ACCESS)
List<String> prosAndCons();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
* Copyright 2014-2025 TNG Technology Consulting GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tngtech.archunit.library.adr.envelopes;

import com.tngtech.archunit.PublicAPI;
import com.tngtech.archunit.library.adr.Adr;
import com.tngtech.archunit.library.adr.Metadata;
import com.tngtech.archunit.library.adr.OptionProsAndCons;

import java.util.List;
import java.util.Optional;

import static com.tngtech.archunit.PublicAPI.Usage.ACCESS;
import static com.tngtech.archunit.PublicAPI.Usage.INHERITANCE;

@PublicAPI(usage = INHERITANCE)
public abstract class AdrEnvelope implements Adr {
private final Adr delegate;

@PublicAPI(usage = ACCESS)
public AdrEnvelope(final Adr delegate) {
this.delegate = delegate;
}

@PublicAPI(usage = ACCESS)
@Override
public Optional<Metadata> metadata() {
return this.delegate.metadata();
}

@PublicAPI(usage = ACCESS)
@Override
public Adr withMetadata(final Metadata metadata) {
return this.delegate.withMetadata(metadata);
}

@PublicAPI(usage = ACCESS)
@Override
public String contextAndProblemStatement() {
return this.delegate.contextAndProblemStatement();
}

@PublicAPI(usage = ACCESS)
@Override
public String title() {
return this.delegate.title();
}

@PublicAPI(usage = ACCESS)
@Override
public Optional<List<String>> decisionDrivers() {
return this.delegate.decisionDrivers();
}

@PublicAPI(usage = ACCESS)
@Override
public Adr withDecisionDrivers(final List<String> decisionDrivers) {
return this.delegate.withDecisionDrivers(decisionDrivers);
}

@PublicAPI(usage = ACCESS)
@Override
public List<String> consideredOptions() {
return this.delegate.consideredOptions();
}

@PublicAPI(usage = ACCESS)
@Override
public String decisionOutcome() {
return this.delegate.decisionOutcome();
}

@PublicAPI(usage = ACCESS)
@Override
public Optional<List<String>> consequences() {
return this.delegate.consequences();
}

@PublicAPI(usage = ACCESS)
@Override
public Adr withConsequences(final List<String> consequences) {
return this.delegate.withConsequences(consequences);
}

@PublicAPI(usage = ACCESS)
@Override
public Optional<String> confirmation() {
return this.delegate.confirmation();
}

@PublicAPI(usage = ACCESS)
@Override
public Adr withConfirmation(final String confirmation) {
return this.delegate.withConfirmation(confirmation);
}

@PublicAPI(usage = ACCESS)
@Override
public Optional<List<OptionProsAndCons>> optionProsAndCons() {
return this.delegate.optionProsAndCons();
}

@PublicAPI(usage = ACCESS)
@Override
public Adr withOptionProsAndCons(final List<OptionProsAndCons> optionProsAndCons) {
return this.delegate.withOptionProsAndCons(optionProsAndCons);
}

@PublicAPI(usage = ACCESS)
@Override
public Optional<String> moreInformation() {
return this.delegate.moreInformation();
}

@PublicAPI(usage = ACCESS)
@Override
public Adr withMoreInformation(final String moreInformation) {
return this.delegate.withMoreInformation(moreInformation);
}

@PublicAPI(usage = ACCESS)
@Override
public String toString() {
return this.delegate.toString();
}
}
Loading