RawHeadersParser()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 1
rs 10
c 0
b 0
f 0
1
package com.hltech.pact.gen.domain.client.util;
2
3
import com.hltech.pact.gen.domain.client.model.Param;
4
5
import java.util.Arrays;
6
import java.util.List;
7
import java.util.stream.Collectors;
8
9
public final class RawHeadersParser {
10
11
    private RawHeadersParser() {}
12
13
    public static List<Param> parseAll(String[] stringHeaderArray) {
14
        return Arrays.stream(stringHeaderArray)
15
            .map(stringHeader -> stringHeader.split("=", 2))
16
            .map(RawHeadersParser::parse)
17
            .collect(Collectors.toList());
18
    }
19
20
    private static Param parse(String[] stringHeaderArray) {
21
        return Param.builder()
22
            .name(stringHeaderArray[0])
23
            .defaultValue(stringHeaderArray[1])
24
            .build();
25
    }
26
}
27