Clean up instance checks and casts
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / services / singlelayer / SingleLayerMultipartRequestCallback.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.openflowplugin.impl.services.singlelayer;
10
11 import java.util.List;
12 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
13 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
14 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
15 import org.opendaylight.openflowplugin.impl.services.AbstractMultipartRequestCallback;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
18
19 public class SingleLayerMultipartRequestCallback<T extends OfHeader> extends AbstractMultipartRequestCallback<T> {
20
21     public SingleLayerMultipartRequestCallback(RequestContext<List<T>> context,
22                                                Class<?> requestType,
23                                                DeviceContext deviceContext,
24                                                EventIdentifier eventIdentifier) {
25         super(context, requestType, deviceContext, eventIdentifier);
26     }
27
28     @Override
29     protected boolean isMultipart(OfHeader result) {
30         return result instanceof MultipartReply;
31     }
32
33     @Override
34     protected boolean isReqMore(T result) {
35         return ((MultipartReply) result).isRequestMore();
36     }
37 }