-
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.
Merge branch 'master' into feature/opprett-pensjonsavtale
- Loading branch information
Showing
8 changed files
with
96 additions
and
143 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
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
35 changes: 34 additions & 1 deletion
35
...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,48 @@ | ||
package no.nav.testnav.libs.dto.skattekortservice.v1; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.Arrays; | ||
import java.util.Objects; | ||
|
||
@Data | ||
@Builder | ||
@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.