2 * Copyright (c) 2016 Red Hat 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;
11 * Builder for NxMatchInfo.
12 * This class, even if not directly called from anywhere statically, is needed
13 * by the XtendBeanGenerator in order to be able to generate code which creates
14 * MatchInfo instances.
16 public class NxMatchInfoBuilder extends AbstractMatchInfoBaseBuilder<NxMatchInfo> {
18 private NxMatchFieldType matchField;
21 public NxMatchInfo build() {
22 if (matchField == null) {
23 throw new IllegalStateException("matchField must be set");
24 } else if (matchValues != null && bigMatchValues == null && stringMatchValues == null) {
25 return new NxMatchInfo(matchField, matchValues);
26 } else if (matchValues == null && bigMatchValues != null && stringMatchValues == null) {
27 return new NxMatchInfo(matchField, bigMatchValues);
28 } else if (matchValues == null && bigMatchValues == null && stringMatchValues != null) {
29 return new NxMatchInfo(matchField, stringMatchValues);
31 throw new IllegalStateException("Can only use either matchValues or bigMatchValues or stringMatchValues");
35 public NxMatchFieldType getMatchField() {
39 public void setMatchField(NxMatchFieldType matchField) {
40 this.matchField = matchField;