com.weaverplatform.protocol.weavermodel.ModelRelation Maven / Gradle / Ivy
package com.weaverplatform.protocol.weavermodel;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author bastbijl, Sysunite 2017
*/
@JsonFilter("skipOptionalField")
@JsonPropertyOrder({ "key", "range", "card", "items" })
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ModelRelation {
@JsonIgnore
private String name;
private String customKey;
@JsonSerialize(using = InlineArraySerializer.class)
private List range;
@JsonSerialize(using = InlineArraySerializer.class)
private List items;
@JsonSerialize(using = InlineArraySerializer.class)
private List card;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getKey() {
if(customKey == null) {
return name;
}
return customKey;
}
public void setKey(String key) {
this.customKey = key;
}
public List getRange() {
return range;
}
public void setRange(List range) {
this.range = range;
}
public List getItems() {
return items;
}
public void setItems(List items) {
this.items = items;
}
public List getCard() {
return card;
}
public void setCard(List card) {
this.card = card;
}
public Set unsetOptionalFields() {
HashSet set = new HashSet<>();
if(customKey == null) {
set.add("key");
}
return set;
}
}