*/
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.CompositeInstantiationObject;
import org.opendaylight.protocol.pcep.object.CompositeStateReportObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
+
+import com.google.common.collect.Lists;
/**
- * @see <a href="http://www.ietf.org/id/draft-crabbe-pce-pce-initiated-lsp-00.txt">5.1. The LSP Create Message</a>
+ * @see <a href="http://www.ietf.org/id/draft-crabbe-pce-pce-initiated-lsp-00.txt">5.1. The LSP Create Message</a>
*/
-public class PCCreateMessage extends PCEPMessage {
-
- private static final long serialVersionUID = -2407399568579836171L;
+public class PCCreateMessage implements Message {
private final List<CompositeInstantiationObject> lsps;
+ private final List<PCEPObject> objects;
+
/**
* Constructs {@link PCCreateMessage}.
- *
- * @throws IllegalArgumentException
- * if there is not even one {@link CompositeInstantiationObject}
- * in the list.
- *
- * @param lsps
- * List<CompositeInstantiationObject>. Can't be empty or null.
+ *
+ * @throws IllegalArgumentException if there is not even one {@link CompositeInstantiationObject} in the list.
+ *
+ * @param lsps List<CompositeInstantiationObject>. Can't be empty or null.
*/
public PCCreateMessage(final List<CompositeInstantiationObject> lsps) {
- super(new ArrayList<PCEPObject>() {
-
- private static final long serialVersionUID = 1L;
-
- {
- if (lsps != null)
- for (final CompositeInstantiationObject cio : lsps) {
- this.addAll(cio.getCompositeAsList());
- }
- }
- });
if (lsps == null || lsps.isEmpty())
throw new IllegalArgumentException("At least one CompositeStateReportObject is mandatory.");
this.lsps = lsps;
+ this.objects = Lists.newArrayList();
+ for (final CompositeInstantiationObject cio : lsps) {
+ this.objects.addAll(cio.getCompositeAsList());
+ }
}
/**
* Gets list of {@link CompositeStateReportObject}.
- *
+ *
* @return List<CompositeStateReportObject>. Can't be null or empty.
*/
public List<CompositeInstantiationObject> getLSPs() {
return this.lsps;
}
+ public List<PCEPObject> getAllObjects() {
+ return this.objects;
+ }
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))