File tree Expand file tree Collapse file tree 4 files changed +74
-0
lines changed
modules/swagger-core/src/test/scala/models/composition Expand file tree Collapse file tree 4 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 1+ package models .composition ;
2+
3+ public abstract class AbstractSignal {
4+ private int type ;
5+ private byte [] value ;
6+
7+ public int getType () {
8+ return type ;
9+ }
10+
11+ public void setType (int type ) {
12+ this .type = type ;
13+ }
14+
15+ public byte [] getRawValue () {
16+ return value ;
17+ }
18+
19+ public void setRawValue (byte [] value ) {
20+ this .value = value ;
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ package models .composition ;
2+
3+ import com .wordnik .swagger .annotations .ApiModel ;
4+
5+ @ ApiModel (description = "AnalogSignal" , parent = Signal .class )
6+ public class AnalogSignal extends AbstractSignal implements Signal {
7+ private float analogValue ;
8+
9+ public float getAnalogValue () {
10+ return analogValue ;
11+ }
12+
13+ public void setAnalogValue (float analogValue ) {
14+ this .analogValue = analogValue ;
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ package models .composition ;
2+
3+ import com .wordnik .swagger .annotations .ApiModel ;
4+
5+ @ ApiModel (description = "AnalogSignal" , parent = DigitalSignal .class )
6+ public class DigitalSignal extends AbstractSignal implements Signal {
7+ private boolean digitalValue ;
8+
9+ public boolean getDigitalValue () {
10+ return digitalValue ;
11+ }
12+
13+ public void setDigitalValue (boolean digitalValue ) {
14+ this .digitalValue = digitalValue ;
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ package models .composition ;
2+
3+ import com .fasterxml .jackson .annotation .*;
4+ import com .fasterxml .jackson .annotation .JsonSubTypes .Type ;
5+ import com .fasterxml .jackson .annotation .JsonTypeInfo .As ;
6+
7+ @ JsonTypeInfo (
8+ use = JsonTypeInfo .Id .NAME ,
9+ include = JsonTypeInfo .As .EXTERNAL_PROPERTY ,
10+ property = "type" )
11+ @ JsonSubTypes ({
12+ @ Type (value = DigitalSignal .class , name = "digital" ),
13+ @ Type (value = AnalogSignal .class , name = "analog" )
14+ })
15+ public interface Signal {
16+ int getType ();
17+ void setType (int type );
18+ byte [] getRawValue ();
19+ void setRawValue (byte [] value );
20+ }
You can’t perform that action at this time.
0 commit comments