Skip to content

Commit 04a6e14

Browse files
author
Ishan
committed
json sub stypes
1 parent 197e04a commit 04a6e14

File tree

3 files changed

+53
-39
lines changed

3 files changed

+53
-39
lines changed

.idea/workspace.xml

Lines changed: 42 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/morph/base/actions/DoubleVariable.java renamed to src/main/java/morph/base/actions/NumberVariable.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
* @author ishan
55
* @since 12/06/17
66
*/
7-
public class DoubleVariable extends Variable {
7+
public class NumberVariable extends Variable {
88

99
private double value;
1010

11-
public DoubleVariable() {
11+
public NumberVariable() {
1212
setVariableType(VariableType.DOUBLE);
1313
}
1414

@@ -20,7 +20,7 @@ public void setValue(double value) {
2020
this.value = value;
2121
}
2222

23-
public DoubleVariable value(final double value) {
23+
public NumberVariable value(final double value) {
2424
this.value = value;
2525
return this;
2626
}

src/main/java/morph/base/actions/Variable.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
package morph.base.actions;
22

3+
import com.fasterxml.jackson.annotation.JsonSubTypes;
4+
import com.fasterxml.jackson.annotation.JsonTypeInfo;
5+
36
/**
47
* @author ishan
58
* @since 12/06/17
69
*/
10+
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "variableType",
11+
visible = true, defaultImpl = Void.class)
12+
@JsonSubTypes({@JsonSubTypes.Type(value = StringVariable.class, name = "STRING"),
13+
@JsonSubTypes.Type(value = StringArrayVariable.class, name = "STRING_ARRAY"),
14+
@JsonSubTypes.Type(value = NumberVariable.class, name = "DOUBLE")})
715
public abstract class Variable {
816

917
private VariableType variableType;

0 commit comments

Comments
 (0)