*/
package org.opendaylight.protocol.pcep.message;
-import java.util.ArrayList;
+import java.util.List;
-import org.opendaylight.protocol.pcep.PCEPMessage;
import org.opendaylight.protocol.pcep.PCEPObject;
import org.opendaylight.protocol.pcep.object.PCEPCloseObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
+
+import com.google.common.collect.Lists;
/**
* Structure of Close Message.
- *
- * @see <a href="http://tools.ietf.org/html/rfc5440#section-6.8">Close
- * Message</a>
+ *
+ * @see <a href="http://tools.ietf.org/html/rfc5440#section-6.8">Close Message</a>
*/
-public class PCEPCloseMessage extends PCEPMessage {
-
- private static final long serialVersionUID = -2365304678646268281L;
+public class PCEPCloseMessage implements Message {
private final PCEPCloseObject closeObj;
+ private final List<PCEPObject> objects;
+
/**
- * Constructs a new Close Message, which has to include PCEP Close Object.
- * Is used to close an established session between PCEP Peers.
- *
- * @throws IllegalArgumentException
- * if the CloseObject passed, is null.
- *
- * @see <a href="http://tools.ietf.org/html/rfc5440#section-6.8">Close
- * Message</a>
- *
- * @param closeObj
- * Can't be null.
+ * Constructs a new Close Message, which has to include PCEP Close Object. Is used to close an established session
+ * between PCEP Peers.
+ *
+ * @throws IllegalArgumentException if the CloseObject passed, is null.
+ *
+ * @see <a href="http://tools.ietf.org/html/rfc5440#section-6.8">Close Message</a>
+ *
+ * @param closeObj Can't be null.
*/
public PCEPCloseMessage(final PCEPCloseObject closeObj) {
- super(new ArrayList<PCEPObject>() {
-
- private static final long serialVersionUID = -8094080277421295531L;
-
- {
- if (closeObj != null)
- this.add(closeObj);
- }
- });
if (closeObj == null)
throw new IllegalArgumentException("PCEPCloseObject is mandatory. Can't be null.");
this.closeObj = closeObj;
+ this.objects = Lists.newArrayList();
+ if (closeObj != null)
+ this.objects.add(closeObj);
}
/**
- * Gets {@link PCEPCloseObject}, which is mandatory object of PCEP Close
- * Message.
- *
+ * Gets {@link PCEPCloseObject}, which is mandatory object of PCEP Close Message.
+ *
* @return {@link PCEPCloseObject} . Can't be null.
*/
public PCEPCloseObject getCloseObject() {
return this.closeObj;
}
+ public List<PCEPObject> getAllObjects() {
+ return this.objects;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))