*/
package org.opendaylight.netconf.sal.connect.netconf;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
private MessageTransformer<NetconfMessage> messageTransformer;
NotificationHandler(final RemoteDeviceHandler<?> salFacade, final RemoteDeviceId id) {
- this.salFacade = Preconditions.checkNotNull(salFacade);
- this.id = Preconditions.checkNotNull(id);
+ this.salFacade = requireNonNull(salFacade);
+ this.id = requireNonNull(id);
}
synchronized void handleNotification(final NetconfMessage notification) {
* @param transformer Message transformer
*/
synchronized void onRemoteSchemaUp(final MessageTransformer<NetconfMessage> transformer) {
- this.messageTransformer = Preconditions.checkNotNull(transformer);
+ this.messageTransformer = requireNonNull(transformer);
passNotifications = true;
}
private DOMNotification transformNotification(final NetconfMessage cachedNotification) {
- final DOMNotification parsedNotification = messageTransformer.toNotification(cachedNotification);
- Preconditions.checkNotNull(
- parsedNotification, "%s: Unable to parse received notification: %s", id, cachedNotification);
- return parsedNotification;
+ return checkNotNull(messageTransformer.toNotification(cachedNotification),
+ "%s: Unable to parse received notification: %s", id, cachedNotification);
}
private void queueNotification(final NetconfMessage notification) {
- Preconditions.checkState(!passNotifications);
+ checkState(!passNotifications);
LOG.debug("{}: Caching notification {}, remote schema not yet fully built", id, notification);
if (LOG.isTraceEnabled()) {