import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import mecsyco.core.type.SimulData; public class DataTypeTemplate implements SimulData{ //Version for avoid warning from Serializable /** * */ private static final long serialVersionUID = 1L; /* * Implementation * variables contain in your new SimulData type * "Type_x" can be anything, double, int, string long, array, matrix, whatever you want and as many you need */ private Type_1 Var1; private Type_2 Var2; private Type_3 Var3; /* * constructor */ public DataTypeTemplate (Type_1 aVar1, Type_2 aVar2, Type_3 aVar3){ Var1=aVar1; Var2=aVar2; Var3= aVar3; } /* * For Jackson, in order that this type can be use in DDS (see User Guide: MECSYCO-com-dds) */ //empty constructor public DataTypeTemplate (){} //getter and setter //Since Jackson 1.9, setter and empty constructor are not mandatory public final Type_1 getVar1(){ return Var1; } public final void setVar1(Type_1 aVar1){ Var1=aVar1; } public final Type_2 getVar2(){ return Var2; } public final void setVar2(Type_2 aVar2){ Var2=aVar2; } //If you don't want that a variable is send by Jackson in DDS, you can ignore it //by using @JsonIgnore before a getter or a setter (or you don't use getter and setter for this variable) @JsonIgnore public final Type_3 getVar3(){ return Var3; } public final void setVar3(Type_3 aVar3){ Var3=aVar3; } /* * Jackson, 2nd method to use it * Instead of using empty constructor, you can use @JsonProperty("variable_name") in the normal constructor * You still need at least getter (and setter for Jackson under 1.9) */ public DataTypeTemplate (@JsonProperty("Var1") Type1 aVar1, @JsonProperty("Var2") Type2 aVar2, @JsonProperty("Var2") Type3 aVar3){ Var1=aVar1; Var2=aVar2; Var3= aVar3; } /* * Optional methods * any methods you think can be helpful (debugging, status, functional etc...) */ }