Skip to content

Commit

Permalink
Merge pull request #373 from guillermocalvo/has-change-status
Browse files Browse the repository at this point in the history
Make classes implement `JApiHasChangeStatus` if they already do
  • Loading branch information
siom79 authored Feb 15, 2024
2 parents ae25d9b + 29c722d commit caaf507
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion japicmp/src/main/java/japicmp/model/JApiAttribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlTransient;

public class JApiAttribute<T> {
public class JApiAttribute<T> implements JApiHasChangeStatus {
private final Optional<T> oldAttribute;
private final Optional<T> newAttribute;
private final JApiChangeStatus changeStatus;
Expand All @@ -27,6 +27,7 @@ public Optional<T> getNewAttribute() {
return newAttribute;
}

@Override
@XmlAttribute(name = "changeStatus")
public JApiChangeStatus getChangeStatus() {
return changeStatus;
Expand Down
3 changes: 2 additions & 1 deletion japicmp/src/main/java/japicmp/model/JApiClassType.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlTransient;

public class JApiClassType {
public class JApiClassType implements JApiHasChangeStatus {
private final Optional<ClassType> oldTypeOptional;
private final Optional<ClassType> newTypeOptional;
private final JApiChangeStatus changeStatus;
Expand All @@ -31,6 +31,7 @@ public String getNewType() {
return OptionalHelper.optionalToString(newTypeOptional);
}

@Override
@XmlAttribute
public JApiChangeStatus getChangeStatus() {
return changeStatus;
Expand Down
3 changes: 2 additions & 1 deletion japicmp/src/main/java/japicmp/model/JApiModifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import javax.xml.bind.annotation.XmlAttribute;

public class JApiModifier<T> {
public class JApiModifier<T> implements JApiHasChangeStatus {
private final Optional<T> oldModifier;
private final Optional<T> newModifier;
private final JApiChangeStatus changeStatus;
Expand All @@ -24,6 +24,7 @@ public Optional<T> getNewModifier() {
return newModifier;
}

@Override
@XmlAttribute(name = "changeStatus")
public JApiChangeStatus getChangeStatus() {
return changeStatus;
Expand Down
3 changes: 2 additions & 1 deletion japicmp/src/main/java/japicmp/model/JApiReturnType.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.ArrayList;
import java.util.List;

public class JApiReturnType implements JApiHasGenericTypes, JApiCompatibility {
public class JApiReturnType implements JApiHasGenericTypes, JApiHasChangeStatus, JApiCompatibility {
private final Optional<String> oldReturnTypeOptional;
private final Optional<String> newReturnTypeOptional;
private final JApiChangeStatus changeStatus;
Expand All @@ -23,6 +23,7 @@ public JApiReturnType(JApiChangeStatus changeStatus, Optional<String> oldReturnT
this.newReturnTypeOptional = newReturnTypeOptional;
}

@Override
@XmlAttribute(name = "changeStatus")
public JApiChangeStatus getChangeStatus() {
return changeStatus;
Expand Down
3 changes: 2 additions & 1 deletion japicmp/src/main/java/japicmp/model/JApiType.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlTransient;

public class JApiType {
public class JApiType implements JApiHasChangeStatus {
private final Optional<String> oldTypeOptional;
private final Optional<String> newTypeOptional;
private final JApiChangeStatus changeStatus;
Expand All @@ -27,6 +27,7 @@ public Optional<String> getNewTypeOptional() {
return newTypeOptional;
}

@Override
@XmlAttribute(name = "changeStatus")
public JApiChangeStatus getChangeStatus() {
return changeStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import japicmp.util.Optional;
import japicmp.model.JApiChangeStatus;
import japicmp.model.JApiHasChangeStatus;
import japicmp.util.OptionalHelper;

import javax.xml.bind.annotation.XmlAttribute;

public class JpaName {
public class JpaName implements JApiHasChangeStatus {
private final Optional<String> newName;
private final Optional<String> oldName;
private final JApiChangeStatus changeStatus;
Expand All @@ -17,6 +18,7 @@ public JpaName(Optional<String> oldName, Optional<String> newName, JApiChangeSta
this.changeStatus = changeStatus;
}

@Override
@XmlAttribute(name = "changeStatus")
public JApiChangeStatus getChangeStatus() {
return changeStatus;
Expand Down

0 comments on commit caaf507

Please sign in to comment.