-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCustomState.java
More file actions
37 lines (31 loc) · 1.18 KB
/
CustomState.java
File metadata and controls
37 lines (31 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.checkmarx.ast.predicate;
import com.checkmarx.ast.utils.JsonParser;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.type.TypeFactory;
import lombok.Value;
import java.util.List;
@Value
@JsonDeserialize()
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class CustomState {
Integer id;
String name;
String type;
public CustomState(@JsonProperty("id") Integer id,
@JsonProperty("name") String name,
@JsonProperty("type") String type) {
this.id = id;
this.name = name;
this.type = type;
}
public static <T> T fromLine(String line) {
return JsonParser.parse(line, TypeFactory.defaultInstance().constructType(CustomState.class));
}
public static <T> List<T> listFromLine(String line) {
return JsonParser.parse(line, TypeFactory.defaultInstance().constructCollectionType(List.class, CustomState.class));
}
}