2 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.genius.mdsalutil;
10 import com.google.common.base.MoreObjects;
11 import java.io.Serializable;
12 import java.math.BigInteger;
13 import java.util.Arrays;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
18 public class MatchInfo implements Serializable, MatchInfoBase {
19 private static final long serialVersionUID = 1L;
21 private final MatchFieldType m_matchField;
22 private final long[] m_alMatchValues;
23 private final BigInteger[] m_aBigIntValues;
24 private final String[] m_asMatchValues;
26 public MatchInfo(MatchFieldType matchField, long[] alMatchValues) {
27 m_matchField = matchField;
28 m_alMatchValues = alMatchValues;
29 m_aBigIntValues = null;
30 m_asMatchValues = null;
33 public MatchInfo(MatchFieldType matchField, BigInteger[] alBigMatchValues) {
34 m_matchField = matchField;
35 m_alMatchValues = null;
36 m_aBigIntValues = alBigMatchValues;
37 m_asMatchValues = null;
40 public MatchInfo(MatchFieldType matchField, String[] alStringMatchValues) {
41 m_matchField = matchField;
42 m_alMatchValues = null;
43 m_aBigIntValues = null;
44 m_asMatchValues = alStringMatchValues;
48 public void createInnerMatchBuilder(Map<Class<?>, Object> mapMatchBuilder) {
49 m_matchField.createInnerMatchBuilder(this, mapMatchBuilder);
53 public void setMatch(MatchBuilder matchBuilder, Map<Class<?>, Object> mapMatchBuilder) {
54 m_matchField.setMatch(matchBuilder, this, mapMatchBuilder);
57 public MatchFieldType getMatchField() {
61 public long[] getMatchValues() {
62 return m_alMatchValues;
65 public BigInteger[] getBigMatchValues() {
66 return m_aBigIntValues;
69 public String[] getStringMatchValues() {
70 return m_asMatchValues;
74 public String toString() {
75 return MoreObjects.toStringHelper(this).omitNullValues().add("matchField", m_matchField)
76 .add("matchValues", Arrays.toString(m_alMatchValues))
77 .add("bigMatchValues", Arrays.deepToString(m_aBigIntValues))
78 .add("stringMatchValues", Arrays.deepToString(m_asMatchValues)).toString();