Skip to content

Commit

Permalink
bruk record, deprecae getter
Browse files Browse the repository at this point in the history
  • Loading branch information
janolaveide committed Jun 24, 2021
1 parent 15bbd66 commit 520d3cb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
package no.nav.vedtak.felles.integrasjon.pdl;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

public class PDLExceptionDetails {
private final String type;
private final String cause;
private final String policy;

@JsonCreator
public PDLExceptionDetails(@JsonProperty("type") String type, @JsonProperty("cause") String cause, @JsonProperty("policy") String policy) {
this.type = type;
this.cause = cause;
this.policy = policy;
}

public record PDLExceptionDetails(String type, String cause,String policy) {

@Deprecated(since = "2.3", forRemoval = true)
public String getType() {
return type;
return type();
}

@Deprecated(since = "2.3", forRemoval = true)
public String getCause() {
return cause;
return cause();
}

@Deprecated(since = "2.3", forRemoval = true)
public String getPolicy() {
return policy;
return policy();
}

@Override
public String toString() {
return getClass().getSimpleName() + " [type=" + type + ", cause=" + cause + ", policy=" + policy + "]";
}

}
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
package no.nav.vedtak.felles.integrasjon.pdl;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

public class PDLExceptionExtension {
private final String code;
private final PDLExceptionDetails details;

@JsonCreator
public PDLExceptionExtension(@JsonProperty("code") String code, @JsonProperty("details") PDLExceptionDetails details) {
this.code = code;
this.details = details;
}
public record PDLExceptionExtension(String code, PDLExceptionDetails details) {

@Deprecated(since = "2.3", forRemoval = true)
public PDLExceptionDetails getDetails() {
return details;
}

@Deprecated(since = "2.3", forRemoval = true)
public String getCode() {
return code;
}

@Override
public String toString() {
return getClass().getSimpleName() + " [code=" + code + ", details=" + details + "]";
return code();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public PDLExceptionExtension getExtension() {
return extension;
}

public PDLExceptionDetails getDetails() {
return getExtension().details();
}

public int getStatus() {
return status;
}
Expand Down

0 comments on commit 520d3cb

Please sign in to comment.