BUG-47 : switched subobjects to generated source code.
[bgpcep.git] / pcep / impl / src / main / java / org / opendaylight / protocol / pcep / impl / subobject / EROExplicitExclusionRouteSubobjectParser.java
index 0a2ad69cd9914b8ef8d2935aef67c026200e5d79..3da789766a4d5f2a6d173e25e0b4e259874f9766 100644 (file)
@@ -8,19 +8,31 @@
 package org.opendaylight.protocol.pcep.impl.subobject;
 
 import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.impl.PCEPXROSubobjectParser;
-import org.opendaylight.protocol.pcep.subobject.EROExplicitExclusionRouteSubobject;
+import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
+import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.Subobjects;
 
-public class EROExplicitExclusionRouteSubobjectParser {
-    public static EROExplicitExclusionRouteSubobject parse(byte[] cutBytes, boolean loose) throws PCEPDeserializerException {
-       if (cutBytes == null || cutBytes.length == 0)
-           throw new IllegalArgumentException("Array of bytes is mandatory. Can't be null or empty.");
+public class EROExplicitExclusionRouteSubobjectParser implements EROSubobjectParser, EROSubobjectSerializer {
 
-       return new EROExplicitExclusionRouteSubobject(PCEPXROSubobjectParser.parse(cutBytes));
-    }
+       public static final int TYPE = 33;
 
-    public static byte[] put(EROExplicitExclusionRouteSubobject objToSerialize) {
-       return PCEPXROSubobjectParser.put(objToSerialize.getXroSubobjets());
-    }
+       @Override
+       public Subobjects parseSubobject(final byte[] buffer, final boolean loose) throws PCEPDeserializerException {
+               if (buffer == null || buffer.length == 0)
+                       throw new IllegalArgumentException("Array of bytes is mandatory. Can't be null or empty.");
 
+               // return new EROExplicitExclusionRouteSubobject(PCEPXROSubobjectParser.parse(cutBytes));
+               return null;
+       }
+
+       @Override
+       public byte[] serializeSubobject(final Subobjects subobject) {
+               // return PCEPXROSubobjectParser.put(subobject.getXroSubobjets());
+               return new byte[0];
+       }
+
+       @Override
+       public int getType() {
+               return TYPE;
+       }
 }