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)
31 public class SupportedFlowActions extends Property {
32 private static final long serialVersionUID = 1L;
33 public static final String SupportedFlowActionsPropName = "supportedFlowActions";
34 private List<Class<? extends Action>> actions;
36 private SupportedFlowActions() {
37 super(SupportedFlowActionsPropName);
38 this.actions = new ArrayList<Class<? extends Action>>();
41 public SupportedFlowActions(List<Class<? extends Action>> actions) {
42 super(SupportedFlowActionsPropName);
43 this.actions = new ArrayList<Class<? extends Action>>(actions);
47 public int hashCode() {
49 int result = super.hashCode();
50 result = prime * result + ((actions == null) ? 0 : actions.hashCode());
55 public boolean equals(Object obj) {
59 if (!super.equals(obj)) {
62 if (getClass() != obj.getClass()) {
65 SupportedFlowActions other = (SupportedFlowActions) obj;
66 if (actions == null) {
67 if (other.actions != null) {
70 } else if (!actions.equals(other.actions)) {
76 public List<Class<? extends Action>> getActions() {
77 return new ArrayList<Class<? extends Action>>(this.actions);
80 @XmlElement(name = "value")
82 public String getStringValue() {
83 List<String> nameList = new ArrayList<String>();
84 for (Class<? extends Action> clazz : actions) {
85 nameList.add(clazz.getSimpleName());
87 Collections.sort(nameList);
88 return nameList.toString();
92 public Property clone() {
93 return new SupportedFlowActions(this.actions);
97 public String toString() {
98 return this.getStringValue();