2 * Copyright (c) 2013 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.controller.sal.action;
11 import java.util.ArrayList;
12 import java.util.Collections;
13 import java.util.List;
15 import javax.xml.bind.annotation.XmlAccessType;
16 import javax.xml.bind.annotation.XmlAccessorType;
17 import javax.xml.bind.annotation.XmlElement;
19 import org.opendaylight.controller.sal.core.Property;
22 * @file SupportedFlowActions.java
24 * @brief Class representing the supported flow actions
26 * Describes the supported flow actions
29 @XmlAccessorType(XmlAccessType.NONE)
30 public class SupportedFlowActions extends Property {
31 private static final long serialVersionUID = 1L;
32 public static final String SupportedFlowActionsPropName = "supportedFlowActions";
33 private List<Class<? extends Action>> actions;
35 private SupportedFlowActions() {
36 super(SupportedFlowActionsPropName);
37 this.actions = new ArrayList<Class<? extends Action>>();
40 public SupportedFlowActions(List<Class<? extends Action>> actions) {
41 super(SupportedFlowActionsPropName);
42 this.actions = new ArrayList<Class<? extends Action>>(actions);
46 public int hashCode() {
48 int result = super.hashCode();
49 result = prime * result + ((actions == null) ? 0 : actions.hashCode());
54 public boolean equals(Object obj) {
58 if (!super.equals(obj)) {
61 if (getClass() != obj.getClass()) {
64 SupportedFlowActions other = (SupportedFlowActions) obj;
65 if (actions == null) {
66 if (other.actions != null) {
69 } else if (!actions.equals(other.actions)) {
75 public List<Class<? extends Action>> getActions() {
76 return new ArrayList<Class<? extends Action>>(this.actions);
79 @XmlElement(name = "value")
81 public String getStringValue() {
82 List<String> nameList = new ArrayList<String>();
83 for (Class<? extends Action> clazz : actions) {
84 nameList.add(clazz.getSimpleName());
86 Collections.sort(nameList);
87 return nameList.toString();
91 public Property clone() {
92 return new SupportedFlowActions(this.actions);
96 public String toString() {
97 return this.getStringValue();