-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Trekktype and refactor related code
#deploy-skatte-service Removed the Trekktype class and refactored related code to use Forskuddstrekk directly. Updated mapping strategies and utility to align with the new structure. This change simplifies the data model and improves maintainability.
- Loading branch information
Showing
7 changed files
with
98 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 36 additions & 5 deletions
41
...er-objects/src/main/java/no/nav/testnav/libs/dto/skattekortservice/v1/Forskuddstrekk.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,46 @@ | ||
package no.nav.testnav.libs.dto.skattekortservice.v1; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
import java.util.Arrays; | ||
import java.util.Objects; | ||
|
||
@Data | ||
@Builder | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Forskuddstrekk { | ||
|
||
private Trekkode trekkode; | ||
private Frikort frikort; | ||
private Trekktabell trekktabell; | ||
private Trekkprosent trekkprosent; | ||
|
||
@JsonIgnore | ||
public boolean isAllEmpty() { | ||
|
||
return contentsCount() == 0; | ||
} | ||
|
||
@JsonIgnore | ||
public boolean isAmbiguous() { | ||
|
||
return contentsCount() > 1; | ||
} | ||
|
||
private long contentsCount() { | ||
|
||
return Arrays.stream(getClass().getDeclaredFields()) | ||
.map(field -> { | ||
try { | ||
field.setAccessible(true); | ||
return field.get(this); | ||
} catch (IllegalAccessException e) { | ||
throw new RuntimeException(e); | ||
} | ||
}) | ||
.filter(Objects::nonNull) | ||
.count(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.