-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathRiskIndicators.java
More file actions
55 lines (44 loc) · 1.35 KB
/
RiskIndicators.java
File metadata and controls
55 lines (44 loc) · 1.35 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.riskified.models;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class RiskIndicators {
private final Map<String, Object> properties = new HashMap<>();
// Generic setter - accepts any field name and value
public RiskIndicators set(String fieldName, Object value) {
properties.put(fieldName, value);
return this;
}
// Generic getter with type casting
@SuppressWarnings("unchecked")
public <T> T get(String fieldName, Class<T> type) {
Object value = properties.get(fieldName);
if (value == null) return null;
return (T) value;
}
// Simple getter (returns Object)
public Object get(String fieldName) {
return properties.get(fieldName);
}
// Check if field exists
public boolean has(String fieldName) {
return properties.containsKey(fieldName);
}
// Get all defined fields
public Set<String> getFields() {
return properties.keySet();
}
// Remove field
public RiskIndicators remove(String fieldName) {
properties.remove(fieldName);
return this;
}
// Get all properties
public Map<String, Object> getAllProperties() {
return new HashMap<>(properties);
}
@Override
public String toString() {
return "RiskIndicators" + properties;
}
}