-
Notifications
You must be signed in to change notification settings - Fork 461
/
Input.java
82 lines (68 loc) · 2.29 KB
/
Input.java
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.dotmarketing.portlets.rules.parameter.display;
import com.dotcms.rest.exception.InvalidRuleParameterException;
import com.dotmarketing.portlets.rules.parameter.type.DataType;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.elasticsearch.common.Nullable;
/**
* @author Geoff M. Granum
*/
public class Input<T extends DataType> {
private final String id;
private final T dataType;
public Input(String id, T dataType) {
this.id = id;
this.dataType = dataType;
}
public String getId() {
return id;
}
public T getDataType() {
return dataType;
}
/**
* Validates the parameter context for the conditionlet. Each input will implement this validation if required.
* @param value parameter value
* @throws InvalidRuleParameterException
*/
public void checkValid(String value) throws InvalidRuleParameterException{
return;
}
/**
* Utility type used to correctly read immutable object from JSON representation.
*
* @deprecated Do not use this type directly, it exists only for the <em>Jackson</em>-binding
* infrastructure
*/
@Deprecated
@JsonDeserialize
@JsonTypeInfo(use = JsonTypeInfo.Id.NONE)
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json {
@javax.annotation.Nullable
String id;
@javax.annotation.Nullable
DataType dataType;
@JsonProperty("id")
public void setKey(@Nullable String id) {
this.id = id;
}
@JsonProperty("dataType")
public void setDataType(@Nullable DataType dataType) {
this.dataType = dataType;
}
}
/**
* @param json A JSON-bindable data structure
* @deprecated Do not use this method directly, it exists only for the <em>Jackson</em>-binding
* infrastructure
*/
@Deprecated
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
static Input fromJson(Input.Json json) {
return new Input(json.id, json.dataType);
}
}