-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed PseudoFuncInput and PseudoFuncOutput to only carry a single v…
…alue. (#18)
- Loading branch information
1 parent
478439e
commit d987381
Showing
11 changed files
with
111 additions
and
329 deletions.
There are no files selected for viewing
46 changes: 3 additions & 43 deletions
46
src/main/java/no/ssb/dapla/dlp/pseudo/func/PseudoFuncInput.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,47 +1,7 @@ | ||
package no.ssb.dapla.dlp.pseudo.func; | ||
|
||
import lombok.Value; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Value | ||
public class PseudoFuncInput { | ||
private final List<Object> values = new ArrayList<>(); | ||
|
||
public PseudoFuncInput(Object v) { | ||
if (v instanceof Collection) { | ||
values.addAll((Collection) v); | ||
} | ||
else if (v.getClass().isArray()) { | ||
values.addAll(Arrays.asList((Object[]) v)); | ||
} | ||
else { | ||
values.add(v); | ||
} | ||
} | ||
|
||
public static PseudoFuncInput of(Object v) { | ||
return new PseudoFuncInput(v); | ||
} | ||
|
||
public List<String> getStringValues() { | ||
return values.stream() | ||
.map(String::valueOf) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
public List<ParamMetadata> getParamMetadata() { | ||
return getStringValues().stream() | ||
.map(ParamMetadata::parse) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.valueOf(values); | ||
public record PseudoFuncInput(String value) { | ||
public static PseudoFuncInput of(String value) { | ||
return new PseudoFuncInput(value); | ||
} | ||
} |
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
Oops, something went wrong.