2 * Copyright (c) 2014 Cisco Systems, Inc. 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
9 package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf;
11 import java.util.List;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
15 import com.google.common.base.Preconditions;
17 public class ClassificationResult {
19 private final String errorMessage;
20 private final boolean isSuccessful;
21 private final List<MatchBuilder> matchBuilders;
24 * @param errorMessage cannot be {@code null}
26 public ClassificationResult(String errorMessage) {
27 this.errorMessage = Preconditions.checkNotNull(errorMessage);
28 this.isSuccessful = false;
33 * @param matches cannot be {@code null}
35 public ClassificationResult(List<MatchBuilder> matches) {
37 this.matchBuilders = Preconditions.checkNotNull(matches);
38 this.isSuccessful = true;
42 * @return list of {@link MatchBuilder}
43 * @throws IllegalStateException if this method is called and {@link #isSuccessfull()} == {@code false}
45 public List<MatchBuilder> getMatchBuilders() {
46 if (isSuccessful == false) {
47 throw new IllegalStateException("Classification was not successfull.");
53 * @return contains error message if {@link #isSuccessfull()} == {@code false}
55 public String getErrorMessage() {
60 * @return {@code true} if {@link ClassificationResult} contains result. {@code false} if {@link ClassificationResult} contains error message.
62 public boolean isSuccessfull() {