aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/container/http/FilterBinding.java
blob: dc53dd66aa0a9d2d408da8f8ddab85615582e719 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.container.http;

import com.yahoo.component.ComponentSpecification;
import com.yahoo.vespa.model.container.component.BindingPattern;

import java.util.Objects;

/**
 * @author bjorncs
 */
public class FilterBinding {

    public enum Type {REQUEST, RESPONSE}

    private final Type type;
    private final ComponentSpecification chainId;
    private final BindingPattern binding;

    private FilterBinding(Type type, ComponentSpecification chainId, BindingPattern binding) {
        this.type = type;
        this.chainId = chainId;
        this.binding = binding;
    }

    public static FilterBinding create(Type type, ComponentSpecification chainId, BindingPattern binding) {
        return new FilterBinding(type, chainId, binding);
    }

    public ComponentSpecification chainId() {
        return chainId;
    }

    public BindingPattern binding() {
        return binding;
    }

    public Type type() { return type; }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FilterBinding that = (FilterBinding) o;
        return type == that.type &&
                Objects.equals(chainId, that.chainId) &&
                Objects.equals(binding, that.binding);
    }

    @Override
    public int hashCode() {
        return Objects.hash(type, chainId, binding);
    }
}