com.yahoo.elide.modelconfig.model.Rule Maven / Gradle / Ivy
/*
* Copyright 2020, Yahoo Inc.
* Licensed under the Apache License, Version 2.0
* See LICENSE file in project root for terms.
*/
package com.yahoo.elide.modelconfig.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* Rules are a list of RSQL filter expression templates that
* support property expansion on the principal object.
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"type",
"filter",
"name"
})
@Data
@EqualsAndHashCode()
@AllArgsConstructor
@NoArgsConstructor
public class Rule {
@JsonProperty("type")
private Rule.Type type;
@JsonProperty("filter")
private String filter;
@JsonProperty("name")
private String name;
public enum Type {
FILTER("filter");
private final String value;
private Type(String value) {
this.value = value;
}
@JsonValue
@Override
public String toString() {
return this.value;
}
}
public enum Filter {
FILTER("filter");
private final String value;
private Filter(String value) {
this.value = value;
}
@JsonValue
@Override
public String toString() {
return this.value;
}
}
}