Skip to content

JSSD Inheritance

AndreasWBartels edited this page Nov 15, 2016 · 1 revision

Definition

net/anwiba/json/schema/example/foo.jssd

{
}

net/anwiba/json/schema/example/bar.jssd

@JssdName(value="foo")
{
  "type": <java.lang.String> "Bar",
  "foos": <foo[]> null
}

result

net/anwiba/json/schema/example/Bar.java

//Copyright (c) 2016 by Andreas W. Bartels
package net.anwiba.json.schema.example;

import com.fasterxml.jackson.annotation.JsonProperty;

public class Bar extends Foo {

    private String type = "Bar";
    private Foo[] foos = null;

    @JsonProperty("type")
    public void setType(final String type) {
        this.type = type;
    }

    @JsonProperty("type")
    public String getType() {
        return this.type;
    }

    @JsonProperty("foos")
    public void setFoos(final Foo[] foos) {
        this.foos = foos;
    }

    @JsonProperty("foos")
    public Foo[] getFoos() {
        if (foos == null) {
          return new Foos[0];
        }
        return this.foos;
    }
}

Clone this wiki locally